HTML DOM Element hasAttributes() method
- Previous Page hasAttribute()
- Next Page hasChildNodes()
- Back to Top ໂອບເອມ ດອມໂອມ Elements
Definition and Usage
If the specified node has attributes hasAttributes()
The method returns true
, otherwise it returns false
.
If the specified node is not an element node, the return value is always false
.
See also:
Tutorial:
Example
Does the <body> element have attributes?
let answer = document.body.hasAttributes();
Syntax
element.hasAttributes()
or
node.hasAttributes()
Parameter
None.
Return Value
Type | Description |
---|---|
Boolean | If the element has attributes, it is true, otherwise it is false. |
Browser Support
element.hasAttributes()
Is DOM Level 2 (2001) feature.
All browsers fully support it:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Support | 9-11 | Support | Support | Support | Support |
- Previous Page hasAttribute()
- Next Page hasChildNodes()
- Back to Top ໂອບເອມ ດອມໂອມ Elements