0

jQuery('#by option:eq(2)').hide();
this is not working in ie. Here by is the id of select element.
sushil bharwani
  • 29,685
  • 30
  • 94
  • 128

1 Answers1

1

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

Baz1nga
  • 15,485
  • 3
  • 35
  • 61
  • This code does not works in ie. Please see the question that its not working in ie. – sushil bharwani Aug 25 '11 at 14:26
  • I could still select a disabled element in IE. In chrome although its working fine. The detach works fine in ie. How would i attach back the element? – sushil bharwani Aug 26 '11 at 05:41
  • use the append api... $("select").append(html); the html in this case should be backed up by you in a temporary variable perhaps before detaching from the dom – Baz1nga Aug 26 '11 at 09:08