XML DOM hasAttributes() Method
Node object
Definition and Usage
The hasAttributes() method returns true if the node has any attributes, otherwise it returns false.
Syntax
nodeObject.hasAttributes()
Example
The following code snippet uses loadXMLDoc() to load "books.xml" into xmlDoc, and return whether the first
Example
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book')[0];
document.write(x.hasAttributes());
Output:
true
Try it »
Node object