HTML <select> Tag

122    Share

Allow Multiple Selections - select Element


Use the multiple attribute to allow the user to select more than one value:


Live Demo & Try it yourself! Read More » »

Visible Values - select Element


Use the size attribute to specify the number of visible values:

 


Live Demo & Try it yourself! Read More » »

The select Element


The <select> element defines a drop-down list:

Example

<label for="class">Choose your Class:</label>
  <select id="class" name="class">
    <option value="6th">6th</option>
    <option value="7th">7th</option>
    <option value="8th">8th</option>
    <option value="9th">9th</option>
    <option value="10th">10th</option>
    <option value="11th">11th</option>
    <option value="12th">12th</option>
  </select>

 

The <option> elements defines an option that can be selected.

By default, the first item in the drop-down list is selected.

To define a pre-selected option, add the selected attribute to the option:

Example

<option value="10th" selected>10th Class</option>

 


Live Demo & Try it yourself! Read More » »