[jQuery] Showing And Hiding Select Options - Works in FF not IE
Hi, this is quite the frustration. It works in Firefox 3.0.1 but not
in IE 7.
Say I have a select box with 7 options. I want to selectively show or
hide options based on a selection in another select box. When the
first select box changes, that fires off a call like:
FilterOptions(1, 1, 1, 0, 0, 0, 1);
A 1 means show the option and a 0 means hide the option. I do this
like so:
function FilterOptions(a, b, c, d, e, f, g)
{
for (var i = 0; i < arguments.length; i++)
{
(arguments[i] == 1) == true ? $("select#FilterOptions option:eq(" +
i + ")").show() : $("select#FilterOptions option:eq(" + i +
")").hide();
}
}
In IE7 all options are shown regardless of 0s or 1s. There are no
script errors. I've managed to alert all sorts of info (IE alerts the
correct values for (arguments[i] == 1) == true) and that shows me the
script gets this far but to no avail. The options stay resolutely
visible :(
Any ideas what is wrong?
Richard