IE 6 javascript onchange() problem
February 6th, 2008
I really hate IE6, but as it is still so common it is important to support it. I recently ran into a problem with the javascript onchange function. I was using onchange to update a text box on the page when the check box was selected. I was using “…onchange(this.checked)…” This worked fine for everything except IE6. It turns out that IE doesn’t fire the onchange state until the checkbox loses focus and so my update was not occurring.
The simple way around for this problem was to change onchange() to onclick(). The function now works in all browsers.
Sphere: Related Content
September 18th, 2008 at 4:03 am
Great blog – it saves me some time.
I also found out that IE has problem with getting the selected value of the radio button by id. The way around is to use form.button_name
November 9th, 2008 at 7:07 pm
Thanks for confirming the problem in IE.
“onchange” should be easy to implement in a browser though :( Nothing like the CSS maze implementation…
Anyway I changed the code to “onclick”…
November 17th, 2008 at 12:43 pm
Sweet, found this article on google, saved me sometime…
Thanks!
March 4th, 2009 at 1:00 am
Amazing find, I just had the same issue, and is no longer an issue!! Thanks for the post.
April 21st, 2009 at 1:59 am
Saved me some time as well! Thanks for sharing!
May 6th, 2009 at 3:19 am
Thanks for posting this. Saved me some time, as well.
May 18th, 2009 at 10:39 pm
Nice post, thanks for speeding that problem to close.
September 9th, 2009 at 6:21 am
Very helpful! My company is still on IE6.
January 14th, 2010 at 3:38 am
thanks blood!
that’s being really kind. not just keping it to urself but saving others wasting lots of time.
bless you.
frost.
March 24th, 2010 at 11:01 pm
Thanks a bunch!!! This saved me a lot of time!
June 17th, 2010 at 8:50 am
Googled: ie6 onchange bug
First result on list and instant solution. Thank you for this article !
John
October 15th, 2010 at 12:44 am
This does not seem to help for select elements. I have tried using onclick in both the select and option tags to no avail.
May 4th, 2011 at 12:41 pm
Hi,
I too have faced the same problem, but the solution of changing the event from onchange to onclick is not an acceptable solution since events are specific to design.
I have found an alternative solution.
—if you call function f1() in onchange event then before the function ends (or before returning from the function) call another function f2() which does nothing i.e function f2(){}.
Try this.. It worked for me..
-Regards,
Vikram
vikramjitsaha@hotmail.com
August 25th, 2011 at 2:30 am
Oh thanks a lot ! I had the same problem, and now, it works !
Thank you !