This does not work, should it? Or can you stop the error if another line could do the same:
function doTheHighlightning(searchTerms) {
// loop through input array of search terms
myArray = searchTerms.split(" ");
for(i=0;i<myArray.length;i++)
{
// works. this line works if not out commented. Will highlight all words, also in the hidden elements
//$('tbody').highlight(myArray[i]);
// not working when trying to skip elements with display none...
$('tbody').css('display') != 'none').highlight(myArray[i]);
}
// set background to yellow for highlighted words
$(".highlight").css({ backgroundColor: "#FFFF88" });
}
I need to filter rows in a table and color some word. The data has become way to much for the coloring if many words are chosen. So I will try to limit the coloring by only going through the none hidden elements.
If you want to get the visible
tbodyelements, you could do this:It looks similar to the answer that Agent_9191 gave, but this one removes the space from the selector, which makes it selects the visible
tbodyelements instead of the visible descendants.EDIT:
If you specifically wanted to use a test on the
displayCSS property of thetbodyelements, you could do this: