English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML DOM removeAttributeNode() method

HTML DOM Element Object

removeAttributeNode()method to add a newAttrnode object.

If you only want to return the attribute value, please usegetAttribute()method.

UsesetAttribute()The method can add a new attribute or change the value of an existing attribute on the element.

Syntax:

element.removeAttributeNode(attrName)
var elem = document.getElementsByTagName("H")1")[0];
var attr = elem.getAttributeNode("class");
elem.removeAttributeNode(attr);
Test See‹/›

Browser Compatibility

All browsers fully support the removeAttributeNode() method:

Method
removeAttributeNode()YesYesYesYesYes

Parameter Value

ParameterDescription
attrNameThe attribute node you want to delete

Technical Details

Return Value:An Attr object representing a deleted attribute node
DOM Version:DOM Level1

Related References

HTML Tutorial:HTML Attributes

HTML DOM Reference:HTML DOM Attribute Object

HTML DOM Reference:element.removeAttribute() method

HTML DOM Reference:element.getAttribute() method

HTML DOM Reference:element.setAttribute() method

HTML DOM Reference:element.hasAttribute() method

HTML DOM Element Object