0

I want to mimic required for select field too. The required field works for select field if the first option is empty. But still i cant see the box which says "please fill out this field"

Is there is a hack or a way i can add the required box to the select field similar like what we have for input field in html5

TylerH
  • 20,799
  • 66
  • 75
  • 101
Saurabh Kumar
  • 16,353
  • 49
  • 133
  • 212
  • So you say you want to have a selectbox with no empty option and still getting the popup that says to fill out the form? – putvande Aug 16 '13 at 08:12
  • But isn't it already filled in by default? I don't really understand what you are trying to do. – putvande Aug 16 '13 at 08:21

1 Answers1

0

required attribute works well on <select>. If you want to force user to make a choice here, create an option with blank value (fiddle).

<select name="choice" required>
    <option value="">None</option>
    <option value="1">One</option>
    <option value="2">Two</option>
</select>

enter image description here

Pavlo
  • 43,301
  • 14
  • 77
  • 113