splitforms.com

HTML · ATTRIBUTE

HTML selected Attribute: Set a Default Select Option

Last reviewed

The selected boolean attribute on an <option> makes it the default choice when the page loads. If no option has it, a single select defaults to the first option. On submit the form sends the select's name with the chosen option's value, or its text when there is no value attribute.

  • Live, editable example
  • Copy-paste snippet
  • Attributes & common mistakes
Live demo · nothing is sent

What gets submitted

Fill in the form above and press its button. The demo stops the request and lists every name=value pair the browser would send, plus the controls it leaves out.

With a free access key in the form, these fields land in your splitforms dashboard; access_key and botcheck are read by splitforms, not stored as lead data.

Edit the HTML and re-run it
Runs in a sandbox. Nothing is sent.

Minimal snippet

selected-example.html
<label for="plan">Plan</label>
<select id="plan" name="plan">
  <option value="basic">Basic</option>
  <option value="pro" selected>Pro</option>
  <option value="team">Team</option>
</select>

Copy-paste code

HTML selected attribute code you can paste today.

Replace YOUR_ACCESS_KEY with a key from your free splitforms dashboard. The form posts to one endpoint — submissions land in your inbox and dashboard with spam filtering built in.

Get free access key
selected.html
<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">
  <label for="email">Email</label>
  <input type="email" id="email" name="email" required>
  <label for="topic">What do you need help with?</label>
  <select id="topic" name="topic" required>
    <option value="" disabled>Choose a topic</option>
    <option value="sales" selected>Sales question</option>
    <option value="support">Technical support</option>
    <option value="partnership">Partnership</option>
  </select>
  <label for="days">Which days suit you?</label>
  <select id="days" name="days" multiple>
    <option value="mon" selected>Monday</option>
    <option value="wed" selected>Wednesday</option>
    <option value="fri">Friday</option>
  </select>
  <input type="checkbox" name="botcheck" style="display:none">
  <button type="submit">Send</button>
</form>

Attributes · selected

Which attributes control the selected option?

selected, value, disabled and the select's multiple attribute decide the default and what is submitted.

HTML selected attribute attributes and what each one does
AttributeWhat it doesDocs
selectedBoolean. Makes this option the default choice when the select loads.MDN
valueThe value submitted for the option; without it, the option's text is sent.MDN
disabledGreys out the option so it cannot be chosen or submitted.MDN
multipleOn the select, lets several options stay selected and submit as repeated pairs.MDN

Common mistakes

selected attribute mistakes to avoid

Distinguish the default state from the current choice and the submitted data.

  1. selected="false" still selects the option

    Boolean attributes are true when present. Remove selected (or omit it) to leave the option unselected; selected="false" still counts as selected.

  2. Only the last selected option wins in a single select

    If several options carry selected and the select has no multiple attribute, the browser keeps the last one. Add multiple if you really need several defaults.

  3. The attribute is the default, not the current choice

    el.defaultSelected reflects the attribute, while el.selected and select.value read the current state. Form reset restores the default.

Sources: WHATWG HTML Standard: selected · MDN: <option>

Copy-paste ready

The HTML selected attribute example below is a complete, working form — paste it into any HTML page and it submits, no edits to the markup required.

No backend to build

Your html selected attribute form posts to one endpoint. No server, PHP, or API route — accepted submissions are saved to your dashboard before owner notification email is attempted; delivery time and inbox placement depend on provider and recipient settings.

A form that really submits

Unlike a static reference snippet, this selected form actually sends data to a free splitforms backend, with spam filtering built in.

How it works

How to add HTML selected attribute to any page.

Copy the html selected attribute example, drop in your free access key, and paste it into any page — submissions start landing in your dashboard.

Copy the code

Copy the HTML selected attribute example below.

Add your access key

Replace YOUR_ACCESS_KEY with a free splitforms key from the dashboard.

Paste into your site

Drop the form into any HTML page. Submissions arrive in your dashboard.

Questions

HTML selected attribute questions, answered.

View all FAQs
How do I set a default option in an HTML select?

Add the `selected` attribute to the `<option>` you want chosen on load, e.g. `<option value="pro" selected>Pro</option>`. Only one option needs it for a single select; remove it to fall back to the first option.

What happens if no option has selected?

A single select shows and submits its first option automatically, even if that option is a placeholder. To force a real choice, make the first option an empty-value placeholder and add `required` to the select.

How do I pre-select several options?

Add the `multiple` attribute to the `<select>`, then put `selected` on each option you want chosen by default. Each selected option is submitted as its own name=value pair under the same name.

What is the difference between selected, defaultSelected and select.value?

The HTML `selected` attribute sets the default; `el.defaultSelected` reflects it. The property `el.selected` is the option's current state, and `select.value` is the value of the currently chosen option. User interaction changes the current state, while form reset restores the default.

How do I make a placeholder that is selected but not submittable?

Add a first option with value="" and disabled, e.g. `<option value="" disabled selected>Choose a topic</option>`, and put `required` on the `<select>` (see the [required attribute](/html/required) page). The placeholder shows until the user picks a real option, and the empty value is rejected on submit.

Simple pricing

How much does splitforms cost?

Free gives you 500 submissions for $0 — no card, no time limit. Pro is $5/month for 5,000 submissions a month, and Annual is $49/year for 15,000 a month with every Pro feature.

Free

$0— 500 submissions
 

No card, no time limit

Best for testing

For side projects and indie devs.

  • 500 free submissions
  • Unlimited forms
  • Email notifications included
  • Smart spam filtering
  • Submissions dashboard
  • Redirect after submit
  • MCP server included

Annual

$49/ year
About $4.08 per month, billed yearly
Best value

Every Pro feature with triple the volume — $0.27 per 1,000 at full use.

  • 15,000 submissions per month
  • Unlimited forms
  • Everything in Pro
  • File uploads with 5 GB storage
  • 3 team seats
  • Priority email support

No credit card required on Free • Cancel anytime • Full pricing and FAQ