outerHTML in Firefox and IE

outerHTML in Firefox and IE

Using jQuery & fairly new to it.  I have the following code:

  1. var msgXML = "<XMLInput><Source></Source><MessageText></MessageText><SendTime></SendTime><Destination></Destination></XMLInput>",
  2. msgXMLDoc = $.parseXML(msgXML),
  3. $msgXML = $( msgXMLDoc );

and make changes to it within a function later in the code.

  1. $msgXML.find("Source").text(mySource);
  2. $msgXML.find("MessageText").text(mtxt);
  3. $msgXML.find("SendTime").text(currDateTime);
  4. $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):

  1. 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.