< option>与显示:无;不适用于IE [英] <option> with display:none; does not work on IE
本文介绍了< option>与显示:无;不适用于IE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在option元素中有一些style='display:none'
,它在Chrome上运行良好,并且我意识到它在IE上不起作用.
I have some style='display:none'
in the option element, it work well on Chrome and I realise it does not work on IE.
<select>
<option style="display:none;">One</option>
<option>Two</option>
<option style="display:none;">Three</option>
<option>Four</option>
</select>
使用jQuery,如何遍历该选项以查找display:none
并删除元素<option>
?
Using jQuery, how to loop through the option to find display:none
and remove the elements <option>
?
推荐答案
这似乎对我有用:
$('select option').each(function(){
if(this.style.display == 'none')
{
$(this).remove();
}
});
这篇关于< option>与显示:无;不适用于IE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文