XML DOM hasAttributes() Method
Element Object
Definition and Usage
The hasAttributes() method returns TRUE when the current element node has attributes, otherwise it returns FALSE.
Syntax
hasAttributes()
Example
The following code snippet uses loadXMLDoc() to load "books.xml" Load into xmlDoc, and check whether the first
Example
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book')[0];
document.write(x.hasAttributes());
Output:
true
Try it »
Element Object