splitforms.com

HTML · FORM CONTROL

HTML Select & Dropdown — pick from a list (live demo)

Last reviewed

The <select> element is a dropdown menu built from <option> tags. The user picks one (or, with the multiple attribute, several) and the chosen option's value is submitted under the select's name. Below is a working form with a dropdown that actually submits.

  • 500 free total
  • No backend
  • Copy-paste ready
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.

Copy-paste code

HTML Select (Dropdown) 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
select.html
<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">

  <label for="name">Name</label>
  <input type="text" id="name" name="name" required>

  <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 selected>Select a topic…</option>
    <option value="sales">Sales question</option>
    <option value="support">Technical support</option>
    <option value="partnership">Partnership</option>
    <option value="other">Something else</option>
  </select>

  <input type="checkbox" name="botcheck" style="display:none">
  <button type="submit">Send</button>
</form>

Datalist vs select

Datalist vs select: which one should you use?

<datalist> gives an <input> a list of suggested values through the input's list attribute; unlike <select>, users can still type any value, and only the input's value is submitted. Use <select> when the answer must be one of your options, and a datalist when the list is a shortcut rather than a rule.

Datalist vs select: which one should you use?
Difference<select><input list> + <datalist>
Can users type their own value?No. The value is always one of the listed options.Yes. The options are suggestions; the input accepts any value that passes its own validation (MDN).
What gets submitted?name=value for the selected <option>, or its text when it has no value.name= plus whatever is in the box, typed or picked. The <datalist> adds nothing: the entry list skips every control inside one (WHATWG).
How are option labels shown?Each option's text is shown; its value stays hidden.It depends on the browser: Firefox shows the label instead of the value, while Chrome and Safari show the value with the label as extra text. Picking one always fills in the value (MDN).
Can the dropdown be styled?The closed box takes CSS. Styling the open list needs customizable select, where the browser supports it.Only the <input>. CSS can barely reach the suggestion list, so it can't be restyled for high-contrast mode either (MDN).
Does it work on mobile?Yes, in every mobile browser MDN tracks (MDN).Chrome for Android 33+ and Safari on iOS 12.2+ show suggestions. Firefox for Android is partial: the suggestion dropdown does not appear (MDN).
Is it accessible?A native control with an implicit combobox role, or listbox with multiple or a size above 1 (MDN).With caveats: the options don't zoom with the page, and some screen reader and browser pairs, including NVDA with Firefox, don't announce the suggestions (MDN).
Baseline statusBaseline widely available, across browsers since July 2015 (MDN).Limited availability, not Baseline: it doesn't work in some of the most widely used browsers (MDN).

Any value can arrive. A datalist never restricts input, and anyone can POST any text to your endpoint, so treat the field as free text, or use a <select> when only listed values make sense. Whatever the user picks or types arrives in your splitforms dashboard: get a free access key.

Sources: MDN: <datalist> · MDN: <input> list attribute · MDN: <select> · WHATWG HTML Standard: the datalist element · WHATWG HTML Standard: the list attribute · WHATWG HTML Standard: constructing the entry list

Live demo · runs in your browser, nothing is sent

<select>

Submitscountry=Canada

Only listed values can be chosen. There is no way to type your own.

<input list> + <datalist>

Submitscountry=

Empty: the field is still submitted, with an empty value.

list.append(option) · datalist.options.length = 8

The datalist adds no entry of its own: both boxes above list exactly what new FormData(form) holds.

Whatever the user picks or types arrives in your splitforms dashboard. Get a free access key

Attributes · <select>

Which HTML Select (Dropdown) attributes matter?

These attributes decide how the <select> behaves and what actually gets emailed to your inbox when someone submits.

HTML Select (Dropdown) attributes and what each one does
AttributeWhat it does
nameThe key the selected value is submitted under.
requiredBoolean. Forces a choice before the form can be submitted.
multipleLets the user pick more than one option (Ctrl/Cmd-click). Each selected option is sent as its own name=value pair under the same name.
sizeNumber of visible options. Setting it turns the dropdown into a scrolling list box.
disabledGreys out the whole control and excludes it from submission.
<option value>The value submitted for that choice. Omit value= and the option's text is submitted instead.
<option selected>Pre-selects an option on load.

Common mistakes

HTML Select (Dropdown) not working? Here's why.

Most broken forms come down to a few small mistakes with the <select>. Check these before you ship, then forward every submission to Slack or a webhook.

  1. The first option is selected by default

    If no option has the selected attribute, the browser submits the first one — even if it's a placeholder. To force a real choice, give the placeholder an empty value (value="") and add required to the <select>, as in the example above.

  2. Without value=, the text is submitted

    If an <option> has no value= attribute, its visible text becomes the submitted value. Always set value= to keep data clean and stable.

  3. multiple changes the UX

    A multiple select is hard to discover on mobile. For more than a few choices, consider checkboxes or a custom component instead.

  4. Swapping in a datalist drops the restriction

    An <input list> with a <datalist> looks like a dropdown but accepts any text, and the <datalist> itself is never submitted. If only listed values are valid, keep the <select> or check the value as in the recipe below.

Sources: WHATWG HTML Standard: <select> · MDN: <select>

<input list> + <datalist>

How do I add autocomplete suggestions to an input?

Give the <datalist> an id, put that id in the input's list attribute, and add one <option value> per suggestion. Browsers filter the list as the user types and fill the box with the picked option's value. Only the input is submitted, as country=France whether it was typed or picked, and whatever the user picks or types arrives in your splitforms dashboard.

A datalist never restricts the value: country=Atlantis is submitted too. To accept listed values only, use a <select> or the check in the next recipe.

datalist.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="country">Country</label>
  <input id="country" name="country" list="countries" required>
  <datalist id="countries">
    <option value="Australia"></option>
    <option value="Canada"></option>
    <option value="France"></option>
    <option value="Germany"></option>
    <option value="India"></option>
    <option value="United Kingdom"></option>
    <option value="United States"></option>
  </datalist>

  <input type="checkbox" name="botcheck" style="display:none">
  <button type="submit">Send</button>
</form>

setCustomValidity()

Can I force a value from the datalist?

Not with HTML alone: no attribute limits an input to its datalist. Compare the value with input.list.options and call setCustomValidity(), so the browser blocks submit with your message until it matches, and on change swap a typed "canada" for the listed "Canada".

This only guides the browser. Anyone can still POST any value to your endpoint, so treat the field as free text wherever you use it, or use a <select>.

datalist-listed-only.html
<input id="country" name="country" list="countries" required>
<datalist id="countries">
  <option value="Canada"></option>
  <option value="France"></option>
  <option value="Germany"></option>
</datalist>

<script>
  const country = document.getElementById("country");

  // The listed option the value matches, ignoring case and outer spaces.
  function listed(input) {
    const typed = input.value.trim().toLowerCase();
    return [...input.list.options].find(
      (o) => !o.disabled && o.value !== "" && o.value.toLowerCase() === typed
    );
  }

  country.addEventListener("input", () => {
    const ok = !country.value || listed(country);
    country.setCustomValidity(ok ? "" : "Choose a country from the list.");
  });

  country.addEventListener("change", () => {
    const match = listed(country);
    if (match) country.value = match.value; // "canada" -> "Canada"
  });
</script>

Copy-paste ready

The HTML Select (Dropdown) 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 select (dropdown) 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 <select> form actually sends data to a free splitforms backend, with spam filtering built in.

How it works

How to add HTML Select (Dropdown) to any page.

Copy the html select (dropdown) 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 Select (Dropdown) 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.

How SplitForms works

What happens after someone submits your form?

splitforms receives the submission, filters spam, saves it to your dashboard and emails you — then, on paid plans, sends it on to your webhooks and integrations. No backend infrastructure to build.

A SplitForms contact form submission launching straight to your inbox

Add your endpoint

Point your form to your unique SplitForms endpoint. That's it.

HTML form pointing at a SplitForms submit endpoint

Receive submissions

We instantly capture and organize every submission in your inbox.

Submissions inbox with searchable leads and status pills

Route anywhere

Send data to email, spreadsheets, CRMs, webhooks, and 7,000+ apps.

Generic integration tiles for email, sheets, chat, CRM, automate, and webhook

No credit card required. Set up in under 60 seconds.

Connect & automate

Where can submissions go besides email?

On paid plans, submissions can also go to Slack, Discord, Google Sheets, Notion, Airtable, Zapier or any signed webhook — and splitforms works on the platforms you build on, from WordPress and Shopify to Next.js. With Stripe connected, your forms can take payments too.

Connect your SplitForms form to Slack, Google Sheets, Mailchimp, Zapier and more
NewTake payments on your formsDeposits, bookings, order forms — submitters check out through Stripe and the money goes straight to your Stripe account. Included on every paid plan.See plans →

Setup guides for the stacks you use

Questions

HTML Select (Dropdown) questions, answered.

View all FAQs
How do I create a dropdown in HTML?

Use a <select> element containing one <option> per choice, each with a value= attribute. Give the <select> a name= so the chosen value is submitted, and use the selected attribute to pre-select an option.

How do I make a placeholder option in a select?

Add a first option with value="" disabled selected, e.g. <option value="" disabled selected>Choose…</option>. Combined with required on the <select>, it forces the user to pick a real option.

How do I allow multiple selections in a dropdown?

Add the multiple attribute to the <select>. The user selects more than one option with Ctrl/Cmd-click, and the field submits multiple values under the same name.

What value does a select submit?

It submits the value= of the chosen <option>. If an option has no value= attribute, the browser submits that option's visible text instead.

Select or radio buttons — which should I use?

Use radio buttons when there are 2–5 options and you want them all visible at once. Use a <select> when there are many options or space is tight and hiding them behind a dropdown keeps the form short.

Datalist vs select: which should I use?

Use a <select> when the value must be one of your options, because users can only pick from the list. Use an <input list> with a <datalist> when the options are shortcuts and any typed value is fine, such as a city or a job title. A datalist never restricts what is submitted.

Can I force a value from a datalist?

Not with HTML alone; no attribute limits an input to its datalist. Check the value against input.list.options in JavaScript and call setCustomValidity() to block submit until it matches, or use a <select>. Anyone can still POST any value, so treat the field as free text where you use it.

Is datalist accessible?

With caveats. MDN notes that datalist options don't zoom with the rest of the page, that the list can't be styled for high-contrast mode, and that some screen reader and browser combinations, including NVDA with Firefox, don't announce the suggestions. Keep a visible <label> and make sure the field works as a plain text input.

Does datalist work on mobile?

Mostly. MDN's compatibility data lists suggestions in Chrome for Android 33+ and Safari on iOS 12.2+, but marks Firefox for Android as partial because the suggestion dropdown does not appear. There the field still works as a plain text input. Datalist support on range, color and date inputs varies more.

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/mo, billed yearly
Best value

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

  • 15,000 submissions / mo
  • 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