The hasAttribute() method returns TRUE if the current element node has the attribute specified by name, and FALSE otherwise.
Parameter | Description |
---|---|
name | Required. Specifies the attribute to find |
TThe following code fragment loads "books.xml" into xmlDoc using loadXMLDoc() and checks if the first <book> element has any "category" attributes:
Output: