Thursday, April 19, 2012

JavaScript IE and Options

First thing I gotta say is, I am not a web developer. Maybe you guys out there all know the problem I had to handle with these days, but for me it was new.
I helped a friend of mine and wrote some JavaScript for him. I dynamically created Options for a select-Tag by using the constructor of the Object:

Option(text, value, defaultSelected, selected)

With FF and Chrome everything was ok. But when my friend tried with his IE it didn't work out.
I knew that there are some differences between FF and IE when it comes to JavaScript but this one seems really ridiculous to me. When you only set the "text" attribute at the Option object it seems like IE doesn't know how to handle it. So no text is presented in the select box. You have to explicitly set the innerText attribute for IE as mentioned in this post.

So, know I'll have to change my script only for IE and I have another reason to be angry at IE.


Post a Comment


Copyright @ 2013 Wrong tracks of a developer.

Designed by Templateiy