我使用一个类型来过滤文本框,在yser中键入他们想要突出显示的数据。然后根据html表中的行检查在textbox中输入的数据。将显示包含类型化数据的行,并隐藏其他行。
我的问题是,这按照预期工作,但问题是它隐藏了header.Is,它可以用任何方式显示标头和突出显示的行?
下面是我使用的脚本:
function Search() {
var value = $('input[id$="txtSearch"]').val();
if (value) {
$('#table-2 tr:not(:first:hidden)').each(function () {
var index = -1;
//$(this).children('td.hiddencls').each(function () {
$(this).children('td').each(function () {
var text = $(this).text();
if (text.toLowerCase().indexOf(value.toLowerCase()) != -1) {
index = 0;
return false;
}
});
if (index == 0) {
$(this).show();
}
else {
$(this).hide();
}
});
}
else
$('#table-2 tr').show();
}请提供你的宝贵建议。
发布于 2013-11-21 05:40:10
把它放在Search()定义的末尾应该能工作
$('#table-2 tr>th').parent().show();(我假设标题行有th标记,而不是td)
否则试试这个
$('#table-2 tr:first').show();https://stackoverflow.com/questions/20113036
复制相似问题