IE HTML radio change event

10,431

Solution 1

Just to add, you can force IE to trigger the onChange event using the onClick event, so if you are allowed use the onClick event to trigger the change event, this should do it:

<input type="radio" onclick="this.blur();"/>

Solution 2

I had the same exact issue. The only options I found were:

  1. Use a js framework that consolidates all of the browser to browser idiosyncrasies (you're going to want to do this, trust me. Have you tested your page in Safari yet?)

  2. If you need the event to trigger but don't want to use onclick, use onfocus or onblur. If you use onblur for the OTHER radios, it is almost identical.

Share:
10,431
Ryan Smith
Author by

Ryan Smith

Just a simple programmer, mostly web stuff. .NET and PHP are the primary languages I work with, but obviously including all the peripheral languages required to make that work.

Updated on July 24, 2022

Comments

  • Ryan Smith
    Ryan Smith almost 2 years

    I have a project that requires some values to get updated with JavaScript from an HTML radio change event.

    For some reason in IE, it seems that the onchange event isn't called until the radio has lost focus. Unfortunately due to the way the code is setup, I can't use the click event and have to use the change event.

    Does anyone know of a way to force IE to raise the change event as soon as the check is changed rather than when it looses focus?

    Thanks.

  • Ryan Smith
    Ryan Smith over 14 years
    Thanks, That solved my immediate issue and saved the day for the client. IE is a plague that should be wiped from the face of the earth.