Home >>jQuery Tutorial >jQuery removeProp() Method

jQuery removeProp() Method

jQuery removeProp() Method

jQuery removeProp() method in jQuery is used to removes a property

Note : you Do not use this method to remove HTML attributes like id, styles, or checked. You can use the removeAttr() method instead.

Syntax:
$(selector).removeProp(property)

Parameter Values

Parameter Description
property This parameter is used to specifies the name of the property to remove
Here is an Example of jQuery removeProp() Method:

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".btn1").click(function(){
var $x = $(".RemoveProp");
$x.prop("color", "f1f1f1");
$x.append("The color property value: " + $x.prop("color"));
$x.removeProp("color");
$x.append("<br> The color property value: " + $x.prop("color"));
});
});
</script>
</head>
<body>
<button class="btn1">click me to Add and remove a property</button><br><br>
<div class="RemoveProp"></div>
</body>
</html>

Output: