HTML DOM removeAttribute()Method

元素对象参考手册Element Object

Examples

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 Yourself »

Definition and Usage

The removeAttribute() method removes the specified attribute.

View similar methods removeAttributeNode() 。


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the removeAttribute() method.


Syntax

element.removeAttribute(attributename)

Parameters

Parameter Type Description
attributename String Required. Specifies the name of the attribute to remove.

Return Value

No return value.

Technical Details

DOM Version Core Level 1 Element Object


元素对象参考手册Element Object

Other Extensions