->tab is the id of table generated.
->we remove case sensitivity in order to match both lower and upper case letters.
->we find each td in table rows,if found it is shown else hided.
$("#search").on('keyup',function() {
var value = $(this).val();
var pat = new RegExp(value, "i");
$('#tab').find('tr').each(function() {
if (!($(this).find('td').text().search(pat) >= 0))
{
$(this).not('.loc').hide();
}
if (($(this).find('td').text().search(pat) >= 0))
{
$(this).show();
}
});
});
Comments
Post a Comment