Search code examples
javascripthtmlinternet-explorerfirefoxprototypejs

Javascript problems with IE, and Prototype 1.6.0.3


The code below works perfectly fine with Firefox, however, I am having problems with IE 8... and 7... instead of populating the select's with the options returned from my php script (like it does in FireFox) it is doing nothing in IE.

I have narrowed the problem down to $('city').innerHTML -- works in Firefox not IE.

Any ideas?

This is in my header:

<script type='text/javascript' src='js/prototype-1.6.0.3.js'></script>
<script type='text/javascript' src='js/scriptaculous.js'></script>

The HTML code (resides in the body)

--snip--
<select id="city">
</select>
--snip--

The JavaScript this gets triggered from the Prov/State onChange (which works on IE and FF)

--snip--
$('city').innerHTML = "<option value='test'> This is a test";
--snip--

Solution

  • How about using update() instead?

    $('city').update("<option value='test'>This is a test</option>");