[b]style="display:none" does not work for option element
[/b]
Hello
I have a select list and I need a way to set certain option tags invisible. I tried applying style="display:none" to the option tags but this has had no effect.
The reason for this is that I am going to use some JavaScript to dynamically enable some selections in the drop down list.
Please see the attached code snippet.
Thanks
[/b]
Hello
I have a select list and I need a way to set certain option tags invisible. I tried applying style="display:none" to the option tags but this has had no effect.
The reason for this is that I am going to use some JavaScript to dynamically enable some selections in the drop down list.
Please see the attached code snippet.
Thanks
<select id="counties" tabindex="1">
<option value="">Select</option>
<option style="display:none" value="IE76176089">Carlow</option>
<option style="display:none" value="IE96268862">Cavan</option>
<option style="display:none" value="IE55624026">Clare</option>
<option style="display:none" value="GB55624026">London</option>
<option style="display:none" value="GB55624026">Surrey</option>
</select>
隐藏下拉选项
本文探讨了在HTML中尝试使用display:none样式使<select>元素内的<option>不可见的问题。该方法并未生效,因为浏览器会忽略此样式。文章附带了一个代码示例,并说明了作者计划通过JavaScript动态启用这些选项。
603

被折叠的 条评论
为什么被折叠?



