0

i am getting below xml, i want to remove outer root element in jquery. Can anyone please help on us.

<root ABC="YYYYY"> <Row trancid="1" trancname="XXXXXXXX" selected="0" row_dst="0" /> </root>

Thanks! in advance.

1 Answer 1

2

You can get the html of root element to use content without parent root node:

var str = '<root ABC="YYYYY"><Row trancid="1" trancname="XXXXXXXX" selected="0" row_dst="0" /></root>';
str = $(str).html()
Sign up to request clarification or add additional context in comments.

6 Comments

@sreehari:works fine for me jsfiddle.net/7spf7dhu. can you reproduce problem in fiddle?
I verified it, it is working in fidler, but when i copy the same code to my page it is returning empty.
jQuery version using here is 1.6.2
Share the link of page
This is intranet site :(
|

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.