Currently I am using jQuery to hide/show select options using following code.
$("#custcol7 option[value=" + sizeValue + "]").hide();
This works fine in Firefox, but doesnt do any good in other browsers. How to I hide options from select in Chrome, Opera and IE?
You will need to remove it and then add it again for Internet Explorer.
To remove:
To add:
Note that you need to have sizeValue also in the option text, to actually see something.
the way you did it should work in chrome but nvm.Here is another way
and if you want to show it again:
It works perfectly on every browser and its really simple code. The problem is if you want to hide several options it is more typing .. but that can be solved by putting them into variables if they don't change dynamically like that :
This way if you have to remove/append on several places you only typed the options once.Hope i gave another interesting option. Best Regards.
You don't, it's not supported in IE (and assumably not in Chrome or Opera either). You would have to remove the options altogether and add them back later if you want them to be truly invisible. But in most cases a simple
disabled="disabled"
should suffice and is a heck of a lot simpler than handling the removing and adding of options.try detach(). you can reattach it later if needed using append() or insertAfter()
In IE 11(Edge), the following code is working.
and to ad back,