Hi everyone, 
 Thanks for everyone who responded for my previous queries.
 Here is an assignment which I feel challenging for our for our jquery guys.
for table with 500 rows. I don't want to use any plugin for this.

Well the task is when we type some thing in a text box it has to show only
those rows which has the value typed in textbox
in one coloumn.

For ex. 
consider a table with id "example" 
<table id="example">
<tbody>
<tr><td> blah vijay</td></tr>
<tr><td> blah victor</td></tr>
<tr><td> blah avinash</td></tr>
<tr><td> blah steven/td></tr>
<tr><td> blah russell</td></tr>
<tr><td> blah suresh</td></tr>

</tbody>
</table>

So, when I type in "vi" in text box only rows that has vijay,victor,avinash
should be shown, remaining should be hidden since all of them has Vi in
their names.

I did it in this way,
let id of text box be textId
$("#textId").keyup(function(){
var val=$("#textId").val(); // which gives value typed in textbox
$("#example tbody tr td.name").each(
function()
{
if( $(this).html().indexOf("val") == -1)
{
 $(this).hide();
}
else  $(this).show();
});
});


This works fine but it's taking 2 secs to do for table with 500 rows. Is
there any better way to do this.
Any staright help is appreciated.
Thanks in advance.

-- 
View this message in context: 
http://www.nabble.com/hide-table-rows-when-we-type-in-text-box-tf4294139s15494.html#a12224030
Sent from the JQuery mailing list archive at Nabble.com.

Reply via email to