jQuery removeAttr()Method

jQuery HTML/CSS 方法jQuery HTML/CSS Methods

Examples

Remove the style attribute from all <p> elements:

$("button").click(function(){ $("p").removeAttr("style"); });

Try it Yourself »

Definition and Usage

The removeAttr() method removes one or more attributes from the selected elements.


Syntax

$(selector).removeAttr(attribute)

Parameter Description
attribute Required. Specifies one or more attributes to remove. To remove several attributes, separate the attribute names with spaces.


实例

More Examples

Remove multiple attributes from the selected elements
How to remove the id and class attributes from the selected elements.


jQuery HTML/CSS 方法jQuery HTML/CSS Methods

Other Extensions