outerHTML in Firefox and IE
Using jQuery & fairly new to it. I have the following code:
- var msgXML = "<XMLInput><Source></Source><MessageText></MessageText><SendTime></SendTime><Destination></Destination></XMLInput>",
- msgXMLDoc = $.parseXML(msgXML),
- $msgXML = $( msgXMLDoc );
and make changes to it within a function later in the code.
- $msgXML.find("Source").text(mySource);
- $msgXML.find("MessageText").text(mtxt);
- $msgXML.find("SendTime").text(currDateTime);
- $msgXML.find("Destination").text(dtxt);
I use this line of code to return the outerHTML (which is the XML with the new data from above in it):
- var newXML = $msgXML.children(0).get(0).outerHTML;
This works perfectly in Firefox. However, IE and Chrome both return "undefined" for the
newXML variable.
I use console.log to display newXML, and it gives me the XML just as I am expecting it to be. What I need to do is to take that & use it as input to another function. IE only returns the "undefined" message in the console log as I am debugging it. Using IE 8, Firefox 20.0.1 and Chrome 26.0.1410.64 m.
Anyone know what the issue might be (and how to resolve it)? Any help appreciated.