Ticket #9725 (closed bug: worksforme)
Undefined response with multiple find()s on the same object
|Reported by:||garytalmes@…||Owned by:||garytalmes@…|
I'm using jQuery 1.6.1 (minified) on Firefox 4 (Mac, Snow Leopard).
Say I do this:
$("#mydiv").find("ul.firstlist li a.current").attr("myname");
This yields the expected result.
But now on the next line I do this:
$("#mydiv").find("ul.secondlist li a.current").attr("myname");
This yields "undefined" every time, even though the html is correct and the values are there. It seems that performing a second find() on the same object does not work. And it's not just with attribute calls. I tried applying CSS and that did not work. I also tried to see if I was able to reference $("#mydiv") at all, and I could not.
Workaround: prior to the first find() I make a copy of $("#mydiv") and then perform the second find() on the copy.
- Owner set to garytalmes@…
- Status changed from new to pending
- Priority changed from undecided to low
- Resolution set to worksforme
- Status changed from pending to closed
- Component changed from unfiled to attributes