jQuery | prop() with Examples
The prop() is an inbuilt method in jQuery which is used to set or return properties and values for the selected elements. When this method is used to return the property value, it returns the value of the FIRST matched element and when this method is used to set property values, it sets one or more property for the selected elements.
Parameters: It accepts two parameters which are specified below-
Return Value: It returns the property and value set for the property for the selected element.
jQuery code to show the working of prop() method:
Before clicking on the “Click Here” button-
After clicking on the “Click Here” button-