要隐藏选择选项值并用新值替换2个选项,可以使用JavaScript来实现。
首先,使用JavaScript获取两个选项的值,然后将这两个值设置为新的值,最后将这两个选项的可见性设置为false,以隐藏它们。
例如:
<select id="mySelect"><option value="1">Option 1</option><option value="2">Option 2</option><option value="3">Option 3</option></select><script>var select = document.getElementById("mySelect");var option1 = select.options[0].value;var option2 = select.options[1].value;select.options[0].value = option2;select.options[1].value = option1;select.options[0].style.display = "none";select.options[1].style.display = "none";</script>