IE 6 javascript onchange() problem

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.

15 comments on “IE 6 javascript onchange() problem
  1. 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. 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. thanks blood!

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

    bless you.


  4. Googled: ie6 onchange bug

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


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

  6. 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..


Leave a Reply

Your email address will not be published. Required fields are marked *