jQuery removeProp() method
The removeProp() method is used to remove the property added by the prop() method. It is an inbuilt method in jQuery. The prop() method in jQuery adds a property to the selected element.
The removeProp() method should not be used to remove the HTML attributes such as id, class, etc. To remove such attributes, we can use the removeAttr() method.
This method accepts a single parameter, which is defined as follows -
property: It is the mandatory parameter. It specifies the property name that needs to remove.
Let's see an illustration to understand the working of the removeProp() method.
It is a simple example of using the removeProp() method. In this example, there is a paragraph element with id = "p1". There are also two buttons named as Add Property and Remove Property. When user will click the Add Property button, the properties will be added to the paragraph with id = "p1". Whereas, on clicking the Remove Property button, the removeProp() method will trigger and remove the properties added using the prop() method.Test it Now
After clicking the given Add button, the output will be -
After clicking the given Remove button, the output will be -