X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML DOM removeAttributeNode() Method

Element Object Reference Element Object

Example

Remove the style attribute node from a header element:

var n=document.getElementsByTagName("INPUT")[0];
var a=n.getAttributeNode("type");
n.removeAttributeNode(a)

Before removing the attribute:

Hello World

After removing the attribute:

Hello World


Try it yourself »

Definition and Usage

The removeAttributeNode() method removes the specified attribute, and returns the removed attribute, as an Attr Node object.

The difference between this method and the removeAttribute() method is that the removeAttribute() method removes the attribute with the specified name, while this method removes the specified Attr object. The result will be the same. Also, the removeAttribute() method has no return value, while this method returns the removed attribute, as an Attr object.

See also the removeAttribute() method


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The removeAttributeNode() method is supported in all major browsers.


Syntax

element.removeAttributeNode(attributenode)

Parameters

Parameter Type Description
attributenode Attr object Required. The attribute node you want to remove

Return Value

Type Description
Attr object The removed attribute node

Technical Details

DOM Version Core Level 1 Element Object


Element Object Reference Element Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook