【问题标题】:jQuery .Filter() only works in debug mode (Chrome and Firefox)jQuery .Filter() 仅适用于调试模式(Chrome 和 Firefox)
【发布时间】:2013-06-06 13:24:34
【问题描述】:

我有一个在 IE 中运行良好的功能,在调试模式下,在 Chrome 和 Firefox 中运行良好。当代码未处于调试模式时,该功能在 Chrome 和 Firefox 中不起作用。

$('#search').keyup(function() 
{
    delay(function () {
        var searchText = $('#search').val().toLowerCase().trim();
        $allListElements = $('#qlTable tr'),
        $matchingListElements = $allListElements.filter(function (i, el) {
            filterIndex = $(el).attr('title').toLowerCase().indexOf(searchText) !== -1;
            return filterIndex;
        });
        $allListElements.hide();
        $matchingListElements.show();
    }, 750);
});

任何帮助将不胜感激。

【问题讨论】:

  • 如果需要,这里是延迟函数的代码:var delay = (function(){ var timer = 0; return function(callback, ms){ clearTimeout (timer); timer = setTimeout(callback, ms); }; })();

标签: jquery filter visual-studio-debugging


【解决方案1】:

已通过使用 .on("keyup") 函数而不是 .keyup() 来解决此问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-09-16
    • 2013-11-14
    • 2016-08-31
    • 2010-09-18
    • 2013-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多