Copyright © tutorialspoint.com
The HTML <optgroup> tag is used for grouping related options within your select list. This makes it easier for users to comprehend their choices when looking at a large list.
NONE
<select> <optgroup label="India"> <option value ="mumbai">Mumbai</option> <option value ="delhi">Delhi</option> </optgroup> <optgroup label="USA"> <option value ="maryland">Marland</option> <option value ="newyork">New York</option> </optgroup> </select> |
This will produce following result:
To Become more comfortable - Do Online Practice
| 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. |
| label | text | Defines a label to use when using <optgroup>. |
| 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 |
| Attribute | Description |
|---|---|
| onclick | Script runs when a mouse click |
| ondblclick | Script runs when a mouse double-click |
| onmousedown | Script runs when mouse button is pressed |
| onmouseup | Script runs when mouse button is released |
| onmouseover | Script runs when mouse pointer moves over an element |
| onmousemove | Script runs when mouse pointer moves |
| onmouseout | Script runs when mouse pointer moves out of an element |
| onkeypress | Script runs when key is pressed and released |
| onkeydown | Script runs when key is pressed |
| onkeyup | Script runs when key is released |
Copyright © tutorialspoint.com