XML DOM ownerElementProperty
Attr object
Definition and Usage
The ownerElement attribute returns the element node to which the attribute is attached.
Syntax
attrObject.ownerElement
Example
The following code snippet usesloadXMLDoc()put "books.xmlLoad into xmlDoc and return the element node to which the first category element is attached:
Example
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book');
document.write(x.item(0).attributes[0].ownerElement);
document.write("<br>");
document.write(x.item(0).attributes[0].ownerElement.nodeName);
document.write("<br>");
document.write(x.item(0).attributes[0].ownerElement.nodeType);
The above code will output:
[object Element]
book
1
book
1
Try it Yourself »
Attr objectother extensions