I have a table of data with hostnames in column two of my table and other data such as location, type, etc. in the other columns. I would like to have a button that will filter any hostname that ends with an H. So far I have the code below that will allow me to filter across all columns and data.

 49 <script>
 50 $(document).ready(function() 
 51 {
 52         $('#search').keyup(function()
 53         {
 54                 searchTable($(this).val());
 55         });
 56 });
 57 
 58 function searchTable(inputVal)
 59 {
 60         var table = $('#toolinfotable');
 61         table.find('tr').each(function(index, row)
 62         {
 63                 var allCells = $(row).find('th');
 64                 if(allCells.length > 0)
 65                 {
 66                         var found = false;
 67                         allCells.each(function(index, td)
 68                         {
 69                                 var regExp = new RegExp(inputVal, 'i');
 70                                 if(regExp.test($(td).text()))
 71                                 {
 72                                         found = true;
 73                                         return false;
 74                                 }
 75                         });
 76                         if(found==true)$(row).hide();else $(row).show();
 77                 }
 78 });
 79 }
 80 </script>

I am unsure how to single out the second column and filter on that alone. Any help would be appreciated.

Thanks!

Perhaps this thread on the jQuery site can help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.