prop() in jQuery
Get or Set the value of a property for the first element in the set of matched elements.
Syntax 1 - Get the value of the property for the first element in the set of matched elements.
$(selector).prop(propertyName)
- propertyName - The name of the property.
Syntax 2 - Set one property for the set of matched elements.
$(selector).prop(propertyName,propertyValue)
- propertyName - The name of the property.
- propertyValue - A value to set for the property. If null, the specified property will be removed.
Syntax 3 - Set more attributes for the set of matched elements.
$(selector).prop({propertyName1:value1,...propertyNamen:valuen)
- propertyName - The name of the property.
- value - A value to set for the property. If null, the specified property will be removed.
Syntax 4
$(selector).prop(propertyName,function(index,currentValue))
- propertyName - The name of the property.
- index - index position of the element in the set.
- currentAttributeValue - The old property value as arguments.