Copyright ©

HTML <select> tag



The HTML <select> tag is used within a form for defining a select list.

Difference between HTML and XHTML:



<form action="/cgi-bin/dropdown.cgi" method="post">
<select name="dropdown">
<option value="Maths" selected>Maths</option>
<option value="Physics">Physics</option>
<input type="submit" value="Submit" />

This will produce following result:

Online Practice:

To Become more comfortable - Do Online Practice


disableddisabledDisables the input control. The button won't accept changes from the user. It also cannot receive focus and will be skipped when tabbing.
multiplemultipleWhen set, it specifies that multiple items can be selected at a time
namefiled nameAssigns a name to the input control.
sizenumberDefines the number of visible items in the drop-down list

Standard Attributes:

classDocument wide identifier
dirSpecifies the direction of the text
idDocument wide identifier
titleSpecifies a title to associate with the element.
styleHelps to include inline casecadubf style sheet.
langSets the language code.
xml:langSets the language code.
tabindexHelps determine the tabbing order
accesskeyAccess keys (or shortcut keys)

Event Attributes:

onfocusScript runs when control gets focus
onblurScript runs when control loses focus
onchangeScript runs when the element changes

Copyright ©