Using $("td.Name") should also improve the scripts performance as well. When you use $(".Name") it will go through all tags on the page. If the class name is on other tags as well, you could always add another selector (e.g. $("td.Name, li.Name").
On Jun 11, 3:02 am, "Dan G. Switzer, II" <[EMAIL PROTECTED]> wrote: > >Thank you. > > >Is it possible to interrupt the script each time the user enter a new > >letter > >in the search box ? > > What I'd recommend doing is building in a setTimeout() delay that would only > fire off the event if the user pauses typing--that way you're not trying to > fire it off for every keystroke. > > As for stop the each(), if you do a return true/false inside the callback > function, it should stop execution of the loop. > > This means you can add a condition to the loop based on a global variable to > determine if you should stop the loop. So, something like the following > would work: > > $(".Name").each( > function (){ > // provided lastTbxValue is a global value that's updated > each > // time the value changes, this should stop the loop > if( tbxValue != lastTbxValue ) return false; > > // create a pointer to the current table cell > var oCell = $(this); > > // hide the parent > oCell.parent().[oCell.text().indexOf(tbxValue) > -1 ? "show" > : "hide"](); > } > ); > > -Dan