I'm working with jQuery and I have a bit of an issue. I have a bunch of DIVs with a certain class, the first of which I'm trying to select. I can't use the first-child pseudo class because of the page layout (long story). But I can get the same effect by treating the jQuery object as an array. My problem is that this does not return a jQuery object but rather a plain Javascript object (specifically a HTMLDivElement).
$("#wizard div.collapsible")[0].addClass("selected");
That fails because the object returned doesn't have an addClass function. It also fails if I use .get(0). However, this does work.
$($("#wizard div.collapsible")[0]).addClass("selected");
Is there a way to do this without have to do the double jQuery selector? (Not that it's a big deal, but it looks kind of confusing.)
.first()api.jquery.com/first