Question

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

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top