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

14 Responses to “IE 6 javascript onchange() problem”

  1. Mark Szu Says:

    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

  2. Mizui Says:

    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”…

  3. m0nk3y Says:

    Sweet, found this article on google, saved me sometime…
    Thanks!

  4. Cavin Myers Says:

    Amazing find, I just had the same issue, and is no longer an issue!! Thanks for the post.

  5. Chris Laprun Says:

    Saved me some time as well! Thanks for sharing!

  6. agnor Says:

    Thanks for posting this. Saved me some time, as well.

  7. Jeff Says:

    Nice post, thanks for speeding that problem to close.

  8. Mark Says:

    Very helpful! My company is still on IE6.

  9. frost Says:

    thanks blood!

    that’s being really kind. not just keping it to urself but saving others wasting lots of time.

    bless you.

    frost.

  10. Alex Says:

    Thanks a bunch!!! This saved me a lot of time!

  11. john Says:

    Googled: ie6 onchange bug

    First result on list and instant solution. Thank you for this article !

    John

  12. slydog Says:

    This does not seem to help for select elements. I have tried using onclick in both the select and option tags to no avail.

  13. Vikram Says:

    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

  14. Maskuime Says:

    Oh thanks a lot ! I had the same problem, and now, it works !

    Thank you !

Leave a Reply

*