jQuery selector for select option not working in ie?
jQuery(开发者_如何学JAVA'#by option:eq(2)').hide();
this is not working in ie. Here by is the id of select element.The problem in IE is not with the selector but with hiding the option as unfortunately this method is not available in IE.
There are two workarounds that you may try to accommodate for the absence of this feature:
- Use the
detach()
function within jquery and utilize and add the option back using theappend()
function. - Add the
disabled
attribute on the option:disabled="disabled"
.
I have shown both here: Live Demo
精彩评论