Grab only 2 items from Jquery Loop
- by Bry4n
Here is my Jquery
$th.each(function(idx) {
var notSelected = $(this).text();
if ((notSelected.indexOf(to) != -1) || (notSelected.indexOf(from) != -1)) {
if (idx < 10)
{
$(this).show();
// and show its corresponding td
$td.eq(idx).show();
}
}
});
It is part of a tableFilter type function for a HTML table. However I want it to only display only 2 of the results. I tried instantiating some kind of index counter but I was unsuccessful. Any help or thoughts would be appreciated.