Pje schrieb:
> Hi,
>
> I need to manipulate a XML that i receive from a request. The XML looks
> like:
>
> <root>
> <company>
> <id>3</id>
> <name>foo</name>
> </company>
> <company>
> <id>5</id>
> <name>bar</name>
> </company>
> </root>
>
> There is a way to get the node company that have a specific id?
>
> $('company:nth('5')', xml).text(); will return the 5th node... what i
> need is the node with id 5. Any tips?
Try
var node;
$('company', xml).each(function() {
var jqId = $('id', this);
if (jqId.text() == 5) {
node = jqId[0];
return false; // break
}
});
Maybe this works too:
var node = $('company/id[5]').parent();
-- Klaus
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/