Welcome to WebmasterWorld Guest from 23.22.46.195

Forum Moderators: open

IE cuts off first option tag using innerHTML

   
2:52 am on Oct 22, 2006 (gmt 0)

10+ Year Member



I'm using a small AJAX function to populate a dropdown list. When the response comes back from the server, it's already formatted in HTML as a series of options - I just stick it in an empty dropdown using innerHTML. This works in Firefox, but in IE, the first option is cut off before the text of the option.

So if the server sends me:
<option value="one">one</option>
<option value="two">two</option>

In IE, I get:
one</option>
<option value="two">two</option>

Does anyone have a solution for this? Thank you so much!

9:18 am on Oct 22, 2006 (gmt 0)

10+ Year Member



Are you using an array in your script that accepts your AJAX HTTP Request? I ask because maybe you are looping through the array starting at 1 and should be using 0.
9:19 am on Oct 22, 2006 (gmt 0)

10+ Year Member



I am also thinking that maybe your first option should have a value of 0.
9:19 am on Oct 22, 2006 (gmt 0)

10+ Year Member



Do you have a URL we can look at?
3:49 am on Oct 27, 2006 (gmt 0)

10+ Year Member



Thanks for the responses! I wasn't using an array, but I did end up using one. Turns out this is a known bug in IE. I had to split the response and rebuild the list using the Option object, rather than just using innerHTML to insert the whole thing.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month