开发者

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:

  1. Use the detach() function within jquery and utilize and add the option back using the append() function.
  2. Add the disabled attribute on the option: disabled="disabled".

I have shown both here: Live Demo

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜