optgroup disabled attribute
The disabled attribute on the optgroup element:
- disables the entire group of options; users can't interact with it; the options within that group can't be selected
- disabled is a specific attribute → can be applied ONLY on the next HTML5 elements: button, fieldset, input, keygen, menuitem, optgroup, option, select, textarea
- is an optional attribute
Examples
<optgroup | attribute | = | "value(s)" | > | ... | <⁄optgroup> | example |
---|---|---|---|---|---|---|---|
1. | disabled | = | "", , disabled | <disabled> ... <⁄ > <disabled=""> ... <⁄ > <disabled="disabled"> ... <⁄ > |
Video demonstration optgroup disabled attribute
HTML5 optgroup disabled attribute Tutorial
min | video details |
---|---|
00:00 | video tutorial: disabled attribute on optgroup element |
00:05 | disabled attribute on optgroup element allows you to disable a group of options (is an optional attribute) |
00:12 | let's disable this first group + all its options |
00:25 | the first group is disabled (user interaction is not possible: e.g. unable to select an option) |
00:33 | for example purpose we will disable the second group also |
00:40 | the 2nd group is also disabled (user interaction is not possible) |
00:47 | 'disabled' represents the minimized form of the attribute, returns the true value = disables the group |
00:50 | disabled can have the next 2 values, both returning the true value also: - the empty string: "" - attribute's canonical name: "disabled" |