blob: e56d951133d35ec8b4809b5b9816b8f06ed59287 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<!DOCTYPE html>
<body>
<html>
<select id="test" size="8">
</select>
<script>
var optgroup = document.createElement("optgroup");
optgroup.setAttribute('label', 'An optgroup');
var option = document.createElement("option");
var optionText = document.createTextNode("An option");
option.appendChild(optionText);
var select = document.getElementById("test");
optgroup.appendChild(option);
select.appendChild(optgroup);
</script>
</body>
</html>
|