HTML DOM Element removeAttribute() Method
Example
Remove the class attribute from an <h1> element:
Remove the href attribute from an <a> element:
Description
The removeAttribute() method removes an attribute from an element.
The Difference Between removeAttribute() and removeAttributeNode()
The removeAttribute() method removes an attribute, and does not have a return value.
The removeAttributeNode() method removes an Attr object, and returns the removed object.
The result will be the same.
Syntax
Parameters
The name of the attribute.
Return Value
Browser Support
element.removeAttribute() is a DOM Level 1 (1998) feature.
It is fully supported in all browsers:
| Chrome | Edge | Firefox | Safari | Opera | IE |
| Yes | Yes | Yes | Yes | Yes | 9-11 |