innerHTML to view XML content in a div
开发者_JS百科I have a form that I am using innerHTML to view the contents of one div in another div. When the user clicks the button, they should be able to view their template. However I am dragging a tree from an XML file and even though the code runs, I get undefined as an output. Am a newbie at this, so any help would be much appreciated!
Any thoughts?
Thanks!
you can't use innerHTML property with xml, because it's exist only in HTML DOM. You have to use cloneNode() method instead
node.firstChild.data wont work with tree. It works if you have only textNode inside your element.
精彩评论