HTML DOM hasAttributes()Method
Examples
Check whether the body element has any attributes
document.body.hasAttributes()
Output result:
false
Try it Yourself »
Definition and Usage
The hasAttributes() method returns true if a node has any attributes, otherwise it returns false.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the hasAttributes method
Note:Internet Explorer 8 and earlier versions of IE do not support this method.
Syntax
node.hasAttributes()
Parameters
None
Return Value
| Type | Description |
|---|---|
| Boolean | Returns true if the node has attributes, otherwise returns false |
Technical Details
| DOM Version | Core Level 2 Node Object |
|---|
Other Extensions
Element Object