Hiding listbox option in IE with jQuery?
I finished some jQuery code to manipulate showing/hiding of listbox items and then found it doens' work in IE 8. This simplified example(assume there's a listbox on the page) wor开发者_StackOverflowks fine for hiding all options of a listbox in Firefox, but not for IE. Any ideas why this doesn't work?
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("option").hide();
});
</script>
You can't hide option elements in Internet Explorer. You need to remove them instead:
$('option').detach();
精彩评论