See if the body element has any attributes:
The result will be:
The hasAttributes() method returns true if the specified node has any attributes, otherwise false.
If the specified node is not an Element node, the return value is always false.
![]()
The hasAttributes() method is supported in all major browsers.
Note: Internet Explorer 8 and earlier does not support this method.
None
| Type | Description |
|---|---|
| Boolean | true if the node has attributes, otherwise false |
| DOM Version | Core Level 2 |
|---|
Node Object
Your message has been sent to W3Schools.