Same code
The code in style works well in IE9, but does not work in IE11. The displayed font is still black
Please help me. . . .
What about the option closing tag?
Don’t make a fuss,
What about the option closing tag?
[selected=selected]{color:red;}
selected=selected
<select id="myselect" style="color:red"> <option style="color:black" value="1">1111</option> <option style="color:red" selected value="2">2222222</option></select><script type="text/javascript">document.getElementById("myselect").onchange = function(){ this.style.color = this.options[this.selectedIndex].style.color;}</script>
<select id="myselect" style="color:red"> <option style="color:black" value="1">1111</option> <option style="color:red" selected value="2">2222222</option></select><script type="text/javascript">document.getElementById("myselect").onchange = function(){ this.style.color = this.options[this.selectedIndex].style.color;}</script>