开发者

Jquery element innerXml

I have the followin开发者_如何学运维g simple xml:

<xmldoc>
    <first><node></node></first>
</xmldoc>

I want to select a given node and get the inner xml text.

$(xml).find('xmldoc').**OuterXMLFunctionThatNotExists**()="<first><node></node></first>"

Thanks in advance.


var text = $(xml).html();

It works in chrome

EDIT: let xml be text and not an xml file because jquery will then treat it as new html element. (like document.createElement() )

var text = $("<xmldoc> <first><node></node></first> </xmldoc>").html();

Or i guess you are getting it from an ajax call? Then don't set dataType to xml (jQuery) or use XHR.responseText

you will get only text and text can easily be parsed with jQuery.


try this-

var text = $(xml).find('xmldoc').text();


Try this:

 $(xml).find('xmldoc').parent().text();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜