views:

63

answers:

1

I wrote some jQuery code to .hide() an <option> element in a select dropdown. .hide() is what I want, because later I can call .show() and the options will not need to be resorted, since the now visible option element will not have changed positions.

.hide() worked great in FF/Chrome, but not in IE6/7/8. So my thought was to write more code after the hide which determined if the current browser was capable of hiding the element (rather than writing browser version sniffing code). IE reports that yes, the option element is hidden (even though it isn't).

$('option.hideMe').hide(); var result = $('option.hideMe').is(':visible');

//result === false in IE, but it is still visible in the dropdown.

Before I rewrite the code to either 1) browser sniff or 2) use a different method which includes sorting on all browsers, is there another way of determining this situation?

A: 

The only we to hide an option on IE is to remove it from the select list. you cannot hide it or disble it as far i know.

Vinay B R
Right, but is there a way to feature sniff, rather than the evil, browser sniff, to determine if the current browser supports/doesn't support hiding <option> tags? That is the question that I am looking to get answered.
slolife