Reputation: 1090
I have a script on here that works fine in FF14 and Chrome20.
A part of it is not working in IE9.
If you open the page in IE9 and change the first dropdown (Comprehensive Search) to "Word TM", then the second dropdown will become empty.
In other browsers, the behavior is correct, and it adds two extra lines to the select menu.
Any idea why IE9 does not like this and how to fix it?
Thanks to the comments below, the issue has now been fixed!
Upvotes: 0
Views: 2472
Reputation:
You have a SELECT element (z) with id "report_options" and you try to change its options using innerHTML. This is no working in IE9. Use z.options.remove(zeroBasedPosition) to remove options and z.options.add(OPTION) where OPTION is a DOM element created and added by:
var option = document.createElement("OPTION");
option.text = "your text";
option.value = "your value";
z.options.add(option);
Upvotes: 4
Reputation: 22617
The problem is the way you're creating the <option>
elements inside the <select>
:
z.innerHTML="<option value='no' SELECTED>Not needed</option>...";
Internet Explorer always had problems with <select>
elements and the innerHTML
(you can only use it to clear all the options, with innerHTML = ""
). The only cross-browser way to correctly add options options to a <select>
elements is by using its add
method.
Upvotes: 3