0
我想使用搜索欄搜索表格。我添加了一個代碼,但它只在表格的第一列進行搜索。我想讓表格的所有列都可搜索。你能指導我怎麼做?這是我的代碼。從查詢$row.find("td").text()
:「第一」應該返回行的所有列的文本使整個表格可搜索
$("#search").on("keyup", function() {
var value = $(this).val();
$(".table tr").each(function(index) {
if (index !== 0) {
$row = $(this);
var id = $row.find("td:first").text();
if (id.indexOf(value) !== 0) {
$row.hide();
//$row.html('Records not found!');
//$(".norecord").html('<td colspan="9">Records not found!</td>');
}
else {
$row.show();
}
}
});
});