1

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.

1 Answer 1

1

jQuery:eq is what you are looking for.

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

Otherwise try to read the data with PHP SimpleXML.

Sign up to request clarification or add additional context in comments.

2 Comments

it doesn't work when I try '$(xmlHttpRequest).find("Table OrganizationName:nth-child(1)").text();'
api.jquery.com/eq-selector worked for me. update your answer so I can mark it as correct answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.