0

I have an XML structure where some elements are repeated inside the parent element, and i want to pick the first of the repeated element, how can i achieve that. $(doc).find('myElement').text() returns the concat value of both the elements, can i have only the first value.

Appreciate the help in advance.

Vaibhav

3 Answers 3

1

have you tried: $(doc).find('myElement').first().text() ?

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

Comments

1
$(doc).find('myElement').eq(0).text();

Comments

0

You could use XPath to retrive the information . Can you post the XML file ?

Comments

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.