Previously, the select button's text was only refreshed inside the two non-trivial branches of the selectedness setting algorithm. Paths that left the select with exactly one selected option hit a no-op branch and skipped the refresh. Fix this by implementing the "clone selected option into select button" algorithm and invoking it whenever the set of selected options may have changed.
6 lines
232 B
HTML
6 lines
232 B
HTML
<!DOCTYPE html>
|
|
<select id="s"></select>
|
|
<script>
|
|
document.getElementById("s").innerHTML =
|
|
'<optgroup label="G"><option>Option 1</option><option selected>Option 2</option><option>Option 3</option></optgroup>';
|
|
</script>
|