I’m trying to access XML content attached to the end of a HTML document (generated stuff) with jquery using this method:
$("SELECTION_STATE").find("CHARACTERISTIC").each( function() {
if($(this).attr("name") == "Z_MDST" ) {
alert($(this).find("MEMBER").attr("name"));
}
});
this works fine in Firefox and Chrome but not in IE, it won’t alert anything.
this is the xml I’m trying to traverse
<SELECTION_STATE>
<SELECTION type="CARTESIAN_PRODUCT">
<CHARACTERISTICS>
<CHARACTERISTIC name="Z_MDST">
<SELECTIONS>
<SELECTION type="SINGLE_MEMBER">
<MEMBER name="00002213" type="MEMBER" text="2213"/>
</SELECTION>
</SELECTIONS>
</CHARACTERISTIC>
is there any way I can achieve that with jquery 1.5?
Thanks in advance
Because you are in a HTML document. IE won’t recognize XML.
returns object HTMLUnknownElement in IE
In order to use the XML you’ll have to run it through the IE XML parser. Something like.
You’ll obviously only want to do this if($.browser.msie)
Side question: Are you loading the XML with AJAX?
Updated: Full Example