Jaya Mayu
Jaya Mayu

Reputation: 17257

Getting Nth Element using Xpath and Jquery

I'm trying to traverse through an XML file using jquery mobile.

My code goes as below

testsss = $(xmlHttpRequest).find("Table OrganizationName:first").text();

Now I can get the first OrganisationID element by using the code ("Table OrganizationName:first") but wot if I want to get the 3rd element?? is there any way to do it in Jquery??

Thanks for your time in advance.

Upvotes: 1

Views: 914

Answers (1)

Jannis M
Jannis M

Reputation: 745

jQuery:eq is what you are looking for.

$(xmlHttpRequest).find("Table OrganizationName:eq(2)").text();

Otherwise try to read the data with PHP SimpleXML.

Upvotes: 1

Related Questions