The select Element


« Previous Next »

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!