jQuery :enabled Selector

Beginner
5 min read
Updated: Nov 2026
3 examples
Selectors

Definition

: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.

Syntax

Start with these common calls. Keep them short and readable.

jQuery
$("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)
CallWhat it does
:enabledMatches currently enabled controls
Tag / form scopeAvoids a universal * scan
Supported elementsbutton, input, select, textarea, option, fieldset, …
Return valuejQuery collection of matching elements

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Prefer $("input:enabled") or $("#form :enabled") over bare $(":enabled").
Step 2Use it on elements that support disabled (input, button, select, textarea, …).
Step 3Re-query after toggles — state is live, not a one-time snapshot of HTML.

Return Value

Return ValueDescription
BooleanOften true or false depending on the match or state.

jQuery Examples

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.

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.

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.

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 — Match the Focused Element

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

:focus Selector — Match the Focused Element tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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