Latest web development tutorials

XML DOM hasAttributes () method

Node Object Reference Node objects

Definition and Usage

hasAttributes () method returns true when the node that owns property, otherwise false.

grammar

nodeObject.hasAttributes()


Examples

The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc, and returns the first <book> element has attributes whether:

Examples

xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book')[0];

document.write(x.hasAttributes());

Output:

true

try it"

Node Object Reference Node objects