【发布时间】:2021-11-13 05:56:32
【问题描述】:
我正在尝试限制数量。的过滤器列表。这是我的代码
$(document).ready(function(){
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$(".table tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
所以,当我在搜索框中输入“食物”时,所有 13 个包含食物词的表格行都会出现,其余的都会隐藏。
但我试图只显示前 5 行,而不是全部 13 行。 感谢,如果有人有任何想法。
【问题讨论】:
标签: javascript jquery jquery-plugins