How Do You Create a Drop Down Menu?


Quick Answer

Create a drop-down list on a web page by using a "select" element with as many "option" tags within as there are members of the list. Using attributes such as "disable," "multiple" and "size" in the element adds other types of functionality to the drop-down menu.

Continue Reading
Related Videos

Full Answer

Beyond basic drop-down list functionality, HTML5 adds three more new attributes to extend the select tag. The "autofocus" attribute places the focus on the drop-down list when the page loads. The "form_id" attribute links the drop-down list to one or more forms.

The "option" element used to list items has four attributes available. The "disabled" attribute, for example, disables the option, while the "label" attribute links elements to higher level. The "optgroup" element "select" specifies which list item to use by default. The "value" element assigns a text string to send to the server instead of the text between the open and close option tags.

Tools such as the Cascading Style Sheets format, as well as JavaScript, PHP and jQuery, make additional functionality available in drop-down lists. These tools generate and modify the HTML necessary for dynamic or cascading drop-down lists. When a user selects a country in one drop-down list, these tools look in a file or query a database to fill a second drop-down with state or province names specific for that choice.

Learn more about Internet & Networking

Related Questions