【发布时间】:2020-08-17 21:57:48
【问题描述】:
我有以下代码,它确实过滤了一个表,但是当没有结果时它是空白的。
有人可以帮我在找不到任何结果时添加“未找到结果”消息吗?
$(document).ready(function() {
$("#table_search").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#filter tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
<table>
<tbody id="filter"></tbody>
</table>
【问题讨论】:
标签: javascript jquery