Does the select element have the required attribute?

Codler picture Codler · Nov 27, 2011 · Viewed 57.6k times · Source

Does the select element have the required attribute?

Answer

Ariful Islam picture Ariful Islam · Nov 27, 2011

Yes you can use required attribute in HTML5. But remember, first value should be empty.

<select required>
<option value="">Please select</option>
<option value="first">First</option>
</select>

Here you get the more example:

http://dev.w3.org/html5/spec-author-view/the-select-element.html#the-select-element