jQuery :enabled Selector

Beginner
7 min read
Updated: Oct 2026
5 examples
Live preview

What Is :enabled?

:enabled (since jQuery 1.0) selects form controls that are currently enabled — interactive, with disabled === false. It is a standard CSS pseudo-class and the natural partner of :disabled.

Remember
$("input:enabled")      // interactive inputs
$("button:enabled")     // clickable buttons
$("#form :enabled")     // enabled controls in a form

// :enabled          → disabled property === false
// :not([disabled])  → no disabled attribute in markup

// Toggle with .prop("disabled", false|true)
NeedUse
Find enabled inputs$("input:enabled")
Find disabled inputs$("input:disabled")
Change enabled state.prop("disabled", false)
No disabled attribute$("input:not([disabled])")
All form controls$(":input")

How to Use :enabled

Prefix with a tag or form context, then read or update the enabled set.

  1. Prefer $("input:enabled") or $("#form :enabled") over bare $(":enabled").
  2. Use it on elements that support disabled (input, button, select, textarea, …).
  3. Re-query after toggles — state is live, not a one-time snapshot of HTML.
  4. Enable with .prop("disabled", false); disable with .prop("disabled", true).
  5. Remember :enabled ≠ :not([disabled]) when fieldsets inherit disabled state.
PieceRequired?Role
:enabledYesMatches currently enabled controls
Tag / form scopeRecommendedAvoids a universal * scan
Supported elements—button, input, select, textarea, option, fieldset, …
Return value—jQuery collection of matching elements

Pseudocode

Pseudocode
matches = []
for each element in search context:
    if element supports disabled
       and element.disabled === false:   // live property
        matches.add(element)

return matches

// :not([disabled]) only checks: !hasAttribute("disabled")

Cheat Sheet

Keep these facts handy while working with enabled controls.

TopicDetail
Syntax$("input:enabled")
SincejQuery 1.0 · CSS standard
Live statedisabled property is false
vs :not([disabled])Attribute absence only
Opposite:disabled
Enable.prop("disabled", false)
Bare formAvoid $(":enabled") → universal scan
Empty setNothing enabled → length 0

Live Preview

Toggle which fields are disabled, then run $("input:enabled").

Disable these inputs

Same idea as the official demo — match inputs that are currently enabled.

Result
$("input:enabled").length
→ 2

matched → a=alpha, c=charlie

jQuery Examples

Short, copy-ready snippets. Open DevTools Console, or use Try It Yourself for a live editor.

Example 1 — Official $("input:enabled")

Set a value on every enabled input — the official demo pattern.

jQuery
$("input:enabled").val("this is it");

var lines = [];
$("input").each(function () {
  lines.push(this.name + " = " + this.value +
    (this.disabled ? " [disabled]" : " [enabled]"));
});
$("#out").text(lines.join("\n"));
Try It Yourself

How It Works

  1. Select. $("input:enabled") finds currently interactive inputs.
  2. Write. .val("this is it") updates only that set.
  3. Skip. Disabled inputs keep their original values.
  4. Report. We print each field so you can compare results.

Example 2 — Count Enabled Controls

Compare enabled vs disabled counts on the same form.

jQuery
$("#out").text(
  "Enabled: " + $("input:enabled").length + "\n" +
  "Disabled: " + $("input:disabled").length
);
Try It Yourself

How It Works

  1. Enabled. :enabled counts interactive fields.
  2. Disabled. :disabled is the opposite set.
  3. Together. On a form of only inputs, the two counts usually add up.
  4. Use. Handy for “ready to submit” checks and UI badges.

Example 3 — :enabled vs :not([disabled])

Official subtlety: live enabled state vs missing attribute.

jQuery
$("#out").text(
  ":enabled → " + $("#box input:enabled").length + "\n" +
  ":not([disabled]) → " + $("#box input:not([disabled])").length
);
Try It Yourself

How It Works

  1. Attribute. :not([disabled]) only checks markup.
  2. Live. :enabled requires disabled === false.
  3. Fieldset. A child of <fieldset disabled> may lack its own attribute yet still be disabled.
  4. Prefer. Use :enabled when you care about real interactivity.

Example 4 — Toggle with .prop()

Find with :enabled; change state with .prop("disabled", …).

jQuery
$("#enable").on("click", function () {
  $("#name").prop("disabled", false);
  $("#out").text("Enabled count: " + $("input:enabled").length);
});

$("#disable").on("click", function () {
  $("#name").prop("disabled", true);
  $("#out").text("Enabled count: " + $("input:enabled").length);
});
Try It Yourself

How It Works

  1. Enable. .prop("disabled", false) makes the field interactive.
  2. Find. $("input:enabled") now includes it.
  3. Disable. .prop("disabled", true) locks it again.
  4. Rule. Prefer .prop over .attr for boolean form state.

Example 5 — Scoped Form Query

Limit the search so other forms on the page stay untouched.

jQuery
var n = $("#signup :enabled").length;
var all = $(":enabled").length;

$("#out").text(
  "Inside #signup: " + n + "\n" +
  "Whole page (avoid bare): " + all
);
Try It Yourself

How It Works

  1. Scope. #signup :enabled only searches that form.
  2. Bare. $(":enabled") can include other regions.
  3. Habit. Always scope on multi-form pages.
  4. Types. This also matches enabled buttons/selects inside the form.

Edge Cases & Pitfalls

Check these before relying on :enabled in real forms.

attr

:enabled ≠ :not([disabled])

Attribute absence is not the same as live interactivity. Prefer :enabled when fieldsets or scripts change state.

bare

Bare $(":enabled") scans everything

Official docs recommend a tag or other prefix. Prefer $("input:enabled") or a form scope.

elements

Only supported controls

Use it on button, input, select, textarea, option, fieldset, and similar — not arbitrary divs.

prop

Toggle with .prop(), not .attr()

Boolean form state belongs on the property. After toggling, re-run :enabled to refresh counts.

Browser Support

The :enabled pseudo-class is standard CSS and has been in jQuery since 1.0. It works wherever your jQuery build runs.

✓ Stable · CSS · jQuery 1.0+

jQuery :enabled

Supported across jQuery 1.x, 2.x, and 3.x in every browser that runs your jQuery build. Prefer current jQuery 3.x for modern projects.

100% Form selector support
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
:enabled Universal

Bottom line: Safe everywhere jQuery runs. Prefer a tag or form prefix, and use :enabled (not only :not([disabled])) for live state.

Performance Notes

ApproachCostBest for
$("#form input:enabled")CheapestScoped forms
$("input:enabled")CheapTypical pages
$(":enabled")SlowerAvoid — universal scan
$("input:not([disabled])")CheapAttribute-only checks

Cost is rarely the issue on small forms. Prefixing and scoping matter more for clarity and on pages with many controls.

Key Takeaways

  • Role: match form controls that are interactive right now.
  • Prefix: prefer $("input:enabled") over bare $(":enabled").
  • vs attr: :enabled is live state; :not([disabled]) is markup only.
  • Toggle: use .prop("disabled", …); find with :enabled.

One line: :enabled finds live interactive controls — prefix with a tag, scope to a form, and toggle with .prop().

Frequently Asked Questions

:enabled matches form elements that are currently enabled — interactive and editable. $("input:enabled") finds every enabled input in the search context. Available since jQuery 1.0.
Official jQuery docs: results are usually similar, but :enabled selects elements whose disabled property is strictly false, while :not([disabled]) selects elements without a disabled attribute in the markup. A control inside a disabled fieldset may still fail :enabled even without its own attribute.
Bare :enabled implies the universal selector — equivalent to $("*:enabled"), which scans every element type. Prefer $("input:enabled"), $("button:enabled"), or $("#form :enabled").
Official docs: use it for elements that support the disabled attribute — button, input, select, textarea, optgroup, option, fieldset, and menuitem.
Use .prop("disabled", false) to enable and .prop("disabled", true) to disable. Use :enabled to find controls that are interactive. Prefer .prop over .attr for boolean form properties.
Yes. :enabled is a standard CSS pseudo-class for form controls. jQuery has supported it since 1.0. Prefer a tag prefix for clarity and performance.

Next: :focus Selector

Learn how to match the element that currently has keyboard focus.

:focus tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful