Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML

<option></option>

By Jennifer Kyrnin, About.com

<option> Description:

The <option> element defines elements in a select or drop-down list.

<option> Web Browser Support:

<option> Attributes:

<option> End Tag:

</option> REQUIRED

<option> Contents:

Text. The following tags are valid within the <option> tag:
None

<option> Valid Context:

The <option></option> tag is valid within the following tags:
select, optgroup

<option> Usage:

  • basic options list
    <form>
    <select name="list">
    <option>Name your favorite pet
    <option>dog</option>
    <option>cat</option>
    <option>rabbit</option>
    <option>horse</option>
    </select>
    </form>
  • alternate item selected
    <form>
    <select name="list">
    <option>Name your favorite pet
    <option>dog</option>
    <option>cat</option>
    <option>rabbit</option>
    <option selected="selected">horse</option>
    </select>
    </form>

<option> Special Notes:

  • Using the value attribute is a good idea, especially when the option text includes, spaces or other non-alphabetical characters.
  • The end tag <option> is required in XHTML documents.

More <option></option> Information:

Return to XHTML Element (HTML Tags) Library

Explore Web Design / HTML

About.com Special Features

Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML

©2009 About.com, a part of The New York Times Company.

All rights reserved.