0

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!

2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.