Element.removeAttribute() Remove an attribute
Last updated: 2026-09-09
Element.removeAttribute() Remove an attribute
removeAttribute removes an HTML attribute from the element.
| Category | DOM |
|---|---|
| ES version | DOM |
📝 Syntax
el.removeAttribute('attrName');
Returns:undefined.
Mutates the original:Yes (in place)
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
false
💡 Tip Removing a non-existent attribute is safe.
🌐 Browser support
| Browser | |||||
|---|---|---|---|---|---|
| Element.removeAttribute() | ✓ v1 | ✓ v12 | ✓ v1 | ✓ v1 | ✓ v1 |
| Supported by all modern browsers | |||||
🏷️ Related Items
💡 Related Cases
More case studies coming soon — check back later.
📚 Related Tutorials
❓ FAQ
QremoveAttribute vs undefined?
AremoveAttribute removes the key; undefined keeps it with empty value.
QError for missing attributes?
ANo — silently succeeds.
QremoveAttribute vs delete?
AremoveAttribute for DOM; delete for plain objects.