0

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) works 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>

1 Answer 1

1

You can't hide option elements in Internet Explorer. You need to remove them instead:

$('option').detach();
1
  • Apparently because display:none style isn't recognized by IE for option elements.
    – AaronLS
    May 26, 2011 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.