homepage Welcome to WebmasterWorld Guest from 54.197.108.124
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
IE cuts off first option tag using innerHTML
garann




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

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!

 

brucec




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

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.

brucec




msg:3130545
 9:19 am on Oct 22, 2006 (gmt 0)

I am also thinking that maybe your first option should have a value of 0.

brucec




msg:3130546
 9:19 am on Oct 22, 2006 (gmt 0)

Do you have a URL we can look at?

garann




msg:3136389
 3:49 am on Oct 27, 2006 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved