option(s) selected versus option(s) pre-selected
option selected versus pre-selected
- Syntax 1: Valid, the option is selected after the page is loaded
- Syntax 2: Valid, the second option is pre-selected
- Syntax 3: Valid, the options are selected after the page is loaded
- Syntax 4: Valid, both options are pre-selected
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <!doctype html> <> <> <>...</> </> <> <> <>... <>... </> </> </> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <!doctype html> <> <> <>...</> </> <> <> <>... <>... </> </> </> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <!doctype html> <> <> <>...</> </> <> <> <>... <>... </> </> </> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <!doctype html> <> <> <>...</> </> <> <> <> <> </> </> </> |
Video demonstration option selected versus pre-selected
HTML5 option selected versus pre-selected Tutorial
min | video details |
---|---|
00:04 | video tutorial: option(s) selected ⁄ pre-selected |
00:12 | 1. select ⁄ pre-select an option: - after the page is loaded, we select an option (selected) |
00:21 | adding selected attribute on the 2nd option |
00:27 | - as soon as the page is loaded, the option is already selected (pre-selected) |
00:33 | 2. select ⁄ pre-select multiple options |
00:33 | adding multiple attribute on select element which allows us multiple selection of options |
00:41 | - after the page is loaded, we can select 1 or more options (selected) |
00:47 | adding selected attribute on the first 2 options |
00:53 | - as soon as the page is loaded, the options are selected (pre-selected) |