Latest web development tutorials

jQuery removeAttr () method

jQuery HTML / CSS Methods jQuery HTML / CSS Methods

Examples

Remove the style property from all <p> elements:

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

try it"

Definition and Usage

removeAttr () method to remove one or more attributes from the selected elements.


grammar

$(selector).removeAttr(attribute)

参数 描述
attribute 必需。规定要移除的一个或多个属性。如需移除若干个属性,请使用空格分隔属性名称。


Examples

More examples

Remove several properties from the selected elements
How do you remove id and class attributes from the selected element.


jQuery HTML / CSS Methods jQuery HTML / CSS Methods