jQuery prop() Method
jQuery prop() Method
The prop() method is used to set or return properties and values of the selected elements.
For your Information:-
- When it is used to set property values, it will set one or more property/value pairs for the set of matched elements.
- When it is used to return the property value, it will only return the value of the FIRST matched element.
Syntax:-
- Its syntax for returning value of Property is:- $(selector).prop(property)
- Its syntax for setting Property and Value is:- $(selector).prop(property,value)
- Its syntax for setting multiple Properties and Values is:- $(selector).prop({property:value, property:value,...})
- Its syntax for setting Property and Value by function is:- $(selector).prop(property,function(index,currentvalue))
Further Explanation:-
Parameter | Description |
---|---|
property | Specifies the name of the property |
value | Specifies the value of the property |
function(index,currentvalue) | Specifies a function that returns the property value to set
|
Code Explanation
All Tutorials related to jQuery CSS and HTML Methods
addClass() Method in jQuery
after() Method in jQuery
append() Method in jQuery
appendTo() Method in jQuery
attr() Method in jQuery
before() Method in jQuery
clone() Method in jQuery
css() Method in jQuery
detach() Method in jQuery
empty() Method in jQuery
hasClass() Method in jQuery
height() Method in jQuery
html() Method in jQuery
innerHeight() Method in jQuery
innerWidth() Method in jQuery
insertAfter() Method in jQuery
insertBefore() Method in jQuery
offset() Method in jQuery
offsetParent() Method in jQuery
outerHeight() Method in jQuery
outerWidth() Method in jQuery
position() Method in jQuery
prepend() Method in jQuery
prependTo() Method in jQuery
prop() Method in jQuery
remove() Method in jQuery
removeAttr() Method in jQuery
removeClass() Method in jQuery
removeProp() Method in jQuery
replaceAll() Method in jQuery
replaceWith() Method in jQuery
scrollLeft() Method in jQuery
scrollTop() Method in jQuery
text() Method in jQuery
toggleClass() Method in jQuery
unwrap() Method in jQuery
val() Method in jQuery
width() Method in jQuery
wrap() Method in jQuery
wrapAll() Method in jQuery
wrapInner() Method in jQuery