Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/forms/the-select-element/combobox-selected-option-text-removal.html - WPT Dashboard Interop Dashboard
<!doctype html>
<link rel="match" href="combobox-selected-option-text-removal-ref.html">
<select style="width: 400px">
<option id="opt" value="1">Old text</option>
</select>
<script>
onload = () => {
const opt = document.getElementById('opt');
const oldText = opt.firstChild;
const newText = document.createTextNode('New text');
opt.insertBefore(newText, oldText);
opt.removeChild(oldText);
};
</script>