按输入内的输入按钮

时间:2012-11-03 17:57:14

标签: javascript jquery input

我有以下代码:

var analogSearch = $('#dataTableAnalog_filter :input').val();
var digitalSearch = $('#dataTableDigital_filter :input').val();

以便从输入中获取值

之后,我使用:

    var analogSearchInput = $('#dataTableAnalog_filter :input');
    var digitalSearchInput = $('#dataTableDigital_filter :input');
    analogSearchInput.val(analogSearch);
    digitalSearchInput.val(digitalSearch);

将数据重新输入到输入。我想在每个输入中单击Enter以过滤DataTable。这可能吗?

1 个答案:

答案 0 :(得分:0)

$('#inputId').on('keydown', function(event) {

    if ( event.which == 13 ) {
     //Do Something Here...Submit Maybe?
    }   

});