I want to hide the options for a select tag and below is the code I have written. This works well with Chrome and Firefox but not with IE.
<style>
option{
display:none !important;
}
</style>
<select style="width:400px" id="selectid" >
<option id="result1" value="Select" >Select</option>
<option disabled value="abcd" >abcd</option>
<option disabled value="abcd" >abcd</option>
<option disabled value="abcd" >abcd</option>
<option disabled value="abcd" >abcd</option>
</select>
Is there any simple CSS style that will hide it? I have tried many answers in stackoverflow but no luck. I don't want to unnecessarily go to jquery for a simplle css stuff.
Edit: I dont want the dropdown to appear
I hide the original select table in CSS, and add a supplementary select table for "filtered results". And I just use javascript/jQuery to move the relevant options to the filtered results element.
Works in every browser. HTML:
JavaScript:
JSFIDDLE: Filter available color variants based on selected color category. https://jsfiddle.net/Znote/exdcaqtv/2/
Try this:
It works to me on IE 11.
Below code worked partially for me(in IE):
option#id { visibility: hidden; }
use hidden for it:
You’re not closing the style values in quotations. Look:
style=“display:none;>
So if you add the double quote after: display:none; it should work.
This is what you are looking for. Options cannot be hidden in IE browsers, you can only disable it. Another option is to replace html of select element with empty html. As you can see in the jsfiddle below. Hide options in select element, not working in IE?
Here is the js fiddle:- http://jsfiddle.net/bj5fqj11/3/