Given the following code, how do I use the variable divs created by the first jQuery selector, without rerunning it on the line where I add the class?
So, given this:
var divs = $("div.searchhit");
// more code here using divs.length divs.removeClass("selected"); $("div.searchhit:eq(0)").addClass("selected");
How do I get the last line to look like this:
divs(":eq(0)").addClass("selected");