Remove the style attribute from a header element:
Before removing the attribute:
After removing the attribute:
The removeAttribute() method removes the specified attribute.
The difference between this method and the removeAttributeNode() method is that the removeAttributeNode() method removes the specified Attr object, while this method removes the attribute with the specified name. The result will be the same. Also this method has no return value, while the removeAttributeNode() method returns the removed attribute, as an Attr object.
See also the removeAttributeNode() method
![]()
The removeAttribute() method is supported in all major browsers.
| Parameter | Type | Description |
|---|---|---|
| attributename | String | Required. The name of the attribute you want to remove |
No return value.
| DOM Version | Core Level 1 |
|---|
Your message has been sent to W3Schools.