jQuery :selected Selector

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

What Is :selected?

:selected (since jQuery 1.0) matches <option> elements that are currently selected in a <select>. Official docs: it does not work for checkboxes or radios — use :checked for those.

Remember
$("option:selected")              // selected options
$("select option:selected")       // official-style scope
$("#city option:selected").text() // visible label
$("#city").val()                  // value attribute (simpler)

// Not for checkboxes / radios → use :checked
// Faster pattern:
$("#city option").filter(":selected")
NeedUse
Selected option text$("select option:selected").text()
Selected value$("select").val()
Multi-select labels$("option:selected").map(…).get()
Checkboxes / radios$("input:checked")
Best performance$("option").filter(":selected")

How to Use :selected

Scope to a select, read text or value on change, and re-query after the user picks a new option.

  1. Prefer $("select option:selected") or an id-scoped query.
  2. Bind change on the <select> so results stay current.
  3. Use .text() for the label, .val() on the select for the value.
  4. For multi-select, loop option:selected (official demo pattern).
  5. For speed: $("#id option").filter(":selected") (official tip).
PieceRequired?Role
Selector stringYes:selected (best with an option / select prefix)
<select> contextRecommendedLimits matches to one dropdown
change handlerOptionalRefresh labels/values after user input
Return value—jQuery collection of selected <option>s (0+)

Pseudocode

Pseudocode
matches = []
for each option in search context:
    if option is currently selected:
        matches.add(option)

return matches

// Official change pattern:
on select.change:
    texts = map(matches, option → option.text)
    show(texts)

Cheat Sheet

Keep these facts handy while reading dropdown selections.

TopicDetail
Syntax$("option:selected")
SincejQuery 1.0 · jQuery extension
MatchesSelected <option> elements only
Not forCheckboxes / radios (use :checked)
Label vs value.text() vs select.val()
Multi-selectZero or more options may match
Live stateReflects current selection, not only HTML
Performance$("option").filter(":selected")

Live Preview

Change the dropdown (or multi-select), then read option:selected text — same idea as the official demo.

Mirrors the official jQuery garden options list. Multi-select shows several :selected matches.

Result
$("select option:selected")
single: Shrubs
multi: Flowers Trees
count: 3

/* official change-demo idea */

jQuery Examples

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

Example 1 — Official Demo: option:selected on Change

Collect selected option text whenever the dropdown changes (jQuery API example).

jQuery
$("select")
  .on("change", function () {
    var str = "";
    $("select option:selected").each(function () {
      str += $(this).text() + " ";
    });
    $("#out").text(str);
  })
  .trigger("change");
Try It Yourself

How It Works

  1. Listen. change runs when the user picks a new option.
  2. Query. option:selected finds the currently selected option(s).
  3. Collect. .each() appends each option’s visible text.
  4. Initial draw. .trigger("change") shows the default selection on load.

Example 2 — :selected Does Not Match Checkboxes

Official rule — use :checked for checkboxes and radios.

jQuery
console.log("option:selected →", $("option:selected").length);
console.log("input:selected →", $("input:selected").length);
console.log("input:checked →", $("input:checked").length);
Try It Yourself

How It Works

  1. Options. option:selected finds the chosen dropdown item.
  2. Wrong tool. input:selected does not match checkboxes.
  3. Right tool. input:checked finds the ticked box.
  4. Rule. Dropdowns → :selected; checkboxes/radios → :checked.

Example 3 — Label Text vs .val()

Read the visible label with :selected, or the value with .val().

jQuery
function show() {
  $("#out").text(
    "text: " + $("#city option:selected").text() + "\\n" +
    "value: " + $("#city").val()
  );
}
show();
$("#city").on("change", show);
Try It Yourself

How It Works

  1. Text. option:selected + .text() is what the user sees.
  2. Value. $("#city").val() reads the option’s value attribute.
  3. Refresh. Re-run on change so both stay in sync.
  4. Tip. Prefer .val() when submitting data; use text for display copy.

Example 4 — Multi-Select Selected Options

When multiple is set, several options can be :selected at once.

jQuery
function listSelected() {
  var labels = $("#skills option:selected").map(function () {
    return $(this).text();
  }).get();
  $("#out").text(labels.join(", ") || "(none)");
}
listSelected();
$("#skills").on("change", listSelected);
Try It Yourself

How It Works

  1. Multiple. The multiple attribute allows more than one selection.
  2. Map. .map() builds an array of selected labels.
  3. Join. Display them as a comma-separated list.
  4. Empty. If nothing is selected, show a clear fallback message.

Example 5 — Official Performance Pattern: .filter(":selected")

Select options with CSS first, then narrow with the jQuery extension.

jQuery
var $picked = $("#menu option").filter(":selected");
$("#out").text(
  "filtered: " + $picked.text() + "\\n" +
  "count: " + $picked.length
);
Try It Yourself

How It Works

  1. CSS first. $("#menu option") can use native querySelectorAll.
  2. Filter. .filter(":selected") keeps only selected options.
  3. Same result. You still get the chosen option(s).
  4. Why. Official docs recommend this because :selected is not standard CSS.

Edge Cases & Pitfalls

Check these before relying on :selected in real forms.

wrong type

Not for checkboxes or radios

Official docs: use :checked for those controls. :selected is for <option> only.

non-std

Cannot use bare in querySelectorAll

:selected is a jQuery extension. Prefer $("option").filter(":selected") for better performance.

scope

Many selects on one page

Bare $("option:selected") matches every dropdown. Scope with an id: $("#city option:selected").

empty

Multi-select can have zero selected

Length can be 0. Check before reading .text() or submitting.

Browser Support

The :selected pseudo-class is a jQuery extension and has worked since jQuery 1.0. Selected state on options is standard DOM behavior; use .filter(":selected") after a CSS option query as the docs recommend.

✓ jQuery 1.0+ · extension

jQuery :selected Selector

Supported across jQuery 1.x, 2.x, and 3.x wherever your jQuery build runs. Prefer option:selected or .filter(":selected").

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
:selected Universal

Bottom line: Safe everywhere jQuery runs. Scope to a select, use :checked for checkboxes/radios, and prefer .filter(":selected") on large pages.

Performance Notes

ApproachCostBest for
$("#id option").filter(":selected")BestOfficial recommended pattern
$("#id option:selected")CheapSmall forms / tutorials
$("#id").val()CheapestReading value only (no label text)
$(":selected")SlowerAvoid — universal scan

Official docs: because :selected is not CSS, it cannot use querySelectorAll. Select options with a pure CSS selector first, then .filter(":selected").

Key Takeaways

  • Role: match currently selected <option> elements.
  • Not checkboxes: use :checked for boxes and radios.
  • Change: re-query on change; trigger once for the initial label.
  • Speed: $("option").filter(":selected"); values via .val().

One line: $("select option:selected") reads dropdown choices — not checkboxes — and pairs best with change plus .filter(":selected") when performance matters.

Frequently Asked Questions

:selected matches every option element that is currently selected inside a select dropdown. Official jQuery docs: it works for option elements. Available since jQuery 1.0.
No. Official docs state that :selected does not work for checkboxes or radio inputs — use :checked for those control types instead.
:selected targets selected option elements in a select. :checked matches ticked checkboxes, selected radios, and can also match options. Prefer option:selected when you only care about dropdown selections.
Bind change on select, loop $("select option:selected").each() to collect option text, write it to a div, then .trigger("change") for the initial draw — as in the jQuery API docs.
Use $("#mySelect").val() for the value attribute, or $("#mySelect option:selected").text() for the visible label. Both read the current selection after the user changes the dropdown.
Because :selected is a jQuery extension, first select options with a CSS selector then narrow with .filter(":selected") — for example $("#mySelect option").filter(":selected").

Next: :disabled Selector

Learn how to select disabled form controls with the :disabled selector.

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

9 people found this page helpful