I have some xml like
<entry>
<a>a</a>
...
<subelement>
<b>b</b>
....
</subelement>
</entry>
if I do $(entry).find(‘whatIAmLookingFor’)
it works for some elements, but not for other elements, when those elements are nested in the subelement.
I can get it to work by doing
$(entry).find('subelement').children()[indexofwhatiamlookingfor].textContent;
in Firebug, but obviously this is a hack…
Why would ‘find’ find some elements in a subelement but not others? I had another developer look at this to make sure I had the element names correct (no fat finger issues).
jQuery doesn’t parse XML. You can use the following simple function to do it and use jQuery to do its usual querying stuff on the document: