[jQuery] Append Node to XmlDocument
Is anyone aware of a simple example which appends a node to an
existing XmlDocument?
I am successfully able to update an XmlDocument using the attr()
method. So:
$(xmlElement).attr("Name","new name");
I am even able to create new attributes using this method.
What I would like to be able to do now is create a new child element
of that same xmlElement. I have tried using the after() and
insertAfter() methods:
$(xmlElement).after("<item ItemId='" + newId + "'></item>");
but this does not update the main XmlDocument. I can tell this by
using FireBug's dirxml() output display. So if I do:
console.dirxml(myXmlDoc);
$(xmlElement).after("<item ItemId='" + newId + "'></item>");
console.dirxml(myXmlDoc);
the outputs are exactly the same.
Can anyone shed some light on this issue? Thanks.