Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM removeAttribute() method

HTML DOM removeAttribute() method

Element Object Reference Element object

Example

Remove the style attribute of the head element:

document.getElementsByTagName("H1")[0].removeAttribute("style");

Before removing the attribute:

Hello World

After removing the attribute:

Hello World

Try it »

Definition and Usage

 The removeAttribute() method removes the specified attribute

See similar methods removeAttributeNode() .


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the removeAttribute() method


Syntax

element

.removeAttribute(

attributename

)

Parameters

Parameters Type Description
attributename String Required. Specifies the name of the attribute to be removed.

Return Value

No value is returned.

Technical Details

DOM version Core Level 1 Element Object

Element Object Reference Element object