Dancer
Dancer

Reputation: 17701

Jquery xml parsing loops

Can anyone recommend the best way to do the following?

I need a loop that will loop through the first two xml items and do something with the contents, then a second loop that will loop through items 3 onwards and do something different? How can I specify this?

Thanks for your help

Paul

Upvotes: 0

Views: 1652

Answers (1)

Luke
Luke

Reputation: 1233

Just loop through the items as you would normall (using $.parseXML() and $.each()), but check for the index of the item you're looking at and perform the different actions there.

For example: http://jsfiddle.net/lukemartin/RsXw9/

http://api.jquery.com/jQuery.parseXML/

http://api.jquery.com/each/

Upvotes: 1

Related Questions