如果您想执行此客户端操作,请按照以下步骤操作:
将 jQuery 引用添加到您的页面。添加文本输入 calles txt_Search
。
然后使用这个脚本:
$(document).ready(function () {
$('#txt_Search').keyup(function () {
searchTable($(this).val());
});
function searchTable(inputVal) {
var table = $('#GridView1');
table.find('tr').each(function (index, row) {
var allCells = $(row).find('td');
if (allCells.length > 0) {
var found = false;
allCells.each(
function (index, td) {
var regExp = new RegExp(inputVal, 'i');
if (regExp.test($(td).text())) {
found = true;
return false;
}});
if (found == true) $(row).show(); else $(row).hide();
}
});
}
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
257 次 |
最近记录: |