Skip to main content

Posts

Showing posts from November, 2017

How To Implement a search for the html table generated randomly?

->search is the id of input type box. ->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();                         }                         });                          });