jQuery removeProp()Method

jQuery HTML/CSS 方法jQuery HTML/CSS Methods

Example

Add and remove the attribute named "color":

$("button").click(function(){ var $x = $("div"); $x.prop("color","FF0000"); $x.append("The color attribute:" + $x.prop("color")); $x.removeProp("color"); });

Try it Yourself »

Definition and Usage

The removeProp() method removes prop()the properties set by the method.

Note:Do not use this method to remove HTML attributes such as style, id, or checked. Use theremoveAttr()method instead.


Syntax

$(selector).removeProp(property)

Parameter Description
property Specifies the name of the property to remove.


jQuery HTML/CSS 方法jQuery HTML/CSS Methods

Other Extensions