php - jquery CONTAINS:text -


as seen in code below: in header part called

<input type="text" size="30" onkeyup="filter(this.value)" /> 

--

function filter(a){                 if (a.length > 0)                     {$("tr").hide();                     $("tr:contains('"+a+"')").show();}                else                     {$("tr").show();     } } 

i have list of items in table format wherein there 3 td, item code, item desc, item type

i have input box filter out table matching text inputted in textboxt match in item code only, not in whole tr.

how search in hide whole if doesnt match search? filter table 1 being typed.

html table generated sql select

http://jsfiddle.net/zs4tz/

try following:

$("td:contains("+ +")").parent('tr').show(); 

or

$('td').filter(function() {   return $.trim( $(this).text() ) == a; }).parent('tr').show(); 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -