w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



option(s) selected versus option(s) pre-selected

option selected versus pre-selected

Valid Syntax 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!doctype html>
<html>
<head>
<title>...</title>
</head>
<body>

<select>
<option>...
<option>...
</select>

</body>
</html>
Valid Syntax 2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!doctype html>
<html>
<head>
<title>...</title>
</head>
<body>

<select>
<option>...
<option selected>...
</select>

</body>
</html>
Valid Syntax 3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!doctype html>
<html>
<head>
<title>...</title>
</head>
<body>

<select multiple>
<option>...
<option>...
</select>

</body>
</html>
Valid Syntax 4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!doctype html>
<html>
<head>
<title>...</title>
</head>
<body>

<select multiple>
<option selected>
<option selected>
</select>

</body>
</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)
option intro option optional, occurrences option browser display option parents - children option syntaxoption disabled attributeoption selected attribute