HTML Home
HTML Tags Reference
Selected Reading
© 2013 TutorialsPoint.COM
|
HTML <select> tag
Advertisements
Function:
The HTML <select> tag is used within a form for defining a select list.
Difference between HTML and XHTML:
NONE
Example:
<form action="/cgi-bin/dropdown.cgi" method="post">
<select name="dropdown">
<option value="Maths" selected>Maths</option>
<option value="Physics">Physics</option>
</select>
<input type="submit" value="Submit" />
</form>
|
This will produce following result:
Online Practice:
To Become more comfortable - Do Online Practice
Attributes:
| Attribute | Value | Description |
| disabled | disabled | Disables the input control. The button won't accept changes from the user. It also cannot receive focus and will be skipped when tabbing. |
| multiple | multiple | When set, it specifies that multiple items can be selected at a time |
| name | filed name | Assigns a name to the input control. |
| size | number | Defines the number of visible items in the drop-down list |
Standard Attributes:
| Attribute | Description |
| class | Document wide identifier |
| dir | Specifies the direction of the text |
| id | Document wide identifier |
| title | Specifies a title to associate with the element. |
| style | Helps to include inline casecadubf style sheet. |
| lang | Sets the language code. |
| xml:lang | Sets the language code. |
| tabindex | Helps determine the tabbing order |
| accesskey | Access keys (or shortcut keys) |
Event Attributes:
| Attribute | Description |
| onfocus | Script runs when control gets focus |
| onblur | Script runs when control loses focus |
| onchange | Script runs when the element changes |
Advertisements
|
|
|