.prop() (since 1.6) gets or sets live DOM properties on matched elements — runtime state like checked, disabled, and selectedIndex.
Syntax
Start with these common calls. Keep them short and readable.
jQuery
// Get (first element only)
var on = $("input").prop("checked");
// Set boolean state
$("input").prop("checked", true);
$("input").prop("disabled", false);
// Prefer .val() for typed text
$("input").val("someValue");
Call
What it does
.prop(name)
Get property on first element
.prop(name, value)
Set property on every match
.prop({ … })
Set several properties at once
.prop(name, fn)
Set from function(index, oldValue)
Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.
Parameters
Parameter
Description
name
Used in .prop(name). Get property on first element
value
Used in .prop(name, value). Set property on every match
object
Used in .prop({ … }). Set several properties at once
fn
Used in .prop(name, fn). Set from function(index, oldValue)
Return Value
Return Value
Description
Boolean
Often true or false depending on the match or state.
jQuery object
Most setters and traversing helpers return the jQuery collection so you can chain more methods.
Value / undefined
Getters usually return a value from the first matched element, or undefined when nothing applies.
jQuery Examples
Example 1 — Official attr vs prop
Compare attribute, property, and :checked as the checkbox changes.
Initially checked:
attr: checked | prop: true | :checked: true
After uncheck: prop and :checked become false;
attr still reflects the initial attribute.
How It Works
Listen. Update the readout on every change.
attr. Initial markup attribute — does not track clicks.
prop. Live boolean state of the checkbox.
Example 2 — Set checked
Turn a checkbox on with a boolean property setter.
Object.{ disabled: true } sets the property on each.
Effect. Controls become non-interactive.
Frequently Asked Questions
.prop() gets or sets DOM properties on matched elements. As a getter it returns the property value (any type, or undefined) for the first element only. As a setter it updates every matched element by name/value, plain object, or callback. Available since jQuery 1.6.
.prop() reads and writes live DOM properties (booleans like checked and disabled that change at runtime). .attr() reads and writes HTML attributes (initial markup, usually strings). For form state, use .prop() or .is(":checked").
Prefer .val() for input, textarea, and select values. Use .prop() for boolean and structural properties like checked, disabled, and selectedIndex.
No. .prop(name) returns the first element's property only. Loop with .each() or .map() to read each one. Setters apply to every matched element.
No. Do not call .removeProp() on native properties — it causes unexpected behavior. Reset with .prop("checked", false) or .prop("disabled", false). .removeProp() is for custom properties you added.
The checked attribute maps to the initial default (defaultChecked) and does not update on click. The checked property is a live boolean. Use .prop("checked") or .is(":checked") to test current state.