Thursday, 25 June 2015

How to make select elements required in HTML5 ?




The <select > element is a form-control in HTML and is used to create a drop-down list in web pages.The <option > tags inside the <select > element define the available options in that drop-down list.

 HTML5 supports form input-attribute required="required" for input-type "text" to check the required input-fields.But its not applicable in case of select field. The following code showing how to make select elements required.

<select required>
<option value="">select an option</option>
<option value="value1">Value 1</option>
<option value="value2">Value 2</option>
</select>

View Demo on : http://jsfiddle.net/88rXX/

0 comments:

Post a Comment

Popular Posts

Categories

browser (1) examples (1) facebook (1) Google (3) How to? (4) html5 (1) Microsoft (1) tutorials (2) VLC (1)

Follow My blog

Contributors

Ajesh VC . Powered by Blogger.