jQuery removeProp () method
Examples
Add and remove a property named "color" of:
$("button").click(function(){
var $x = $("div");
$x.prop("color","FF0000");
$x.append("The color 属性: " + $x.prop("color"));
$x.removeProp("color");
});
var $x = $("div");
$x.prop("color","FF0000");
$x.append("The color 属性: " + $x.prop("color"));
$x.removeProp("color");
});
try it"
Definition and Usage
removeProp () method to remove the prop () property set method.
Note: Do not use this method to remove HTML attributes such as style, id checked, or the like.Use removeAttr () instead of the method.
grammar
$(selector).removeProp(property)
参数 | 描述 |
---|---|
property | 规定要移除的属性的名称。 |