Easy Tutorial
❮ Dom Met Nodelist Item Dom Met Document Createtextnode ❯

XML DOM hasAttributes() Method



Definition and Usage

The hasAttributes() method returns true if the node has attributes, otherwise it returns false.

Syntax


Example

The following code snippet uses loadXMLDoc() to load "books.xml" into xmlDoc and checks if the first <book> element has any attributes:

Example

Output:


❮ Dom Met Nodelist Item Dom Met Document Createtextnode ❯