Search code examples
dojointernet-explorer-7dom-events

IE7 and dojo onchange of radio buttons fires too late?


I have a page which has a form and say 3 input radio-buttons and I want to run some code when any of them are changed, so my code looks like this

dojo.query("#ze_form > input:radio").onchange(function () {
    alert("onchange fired!");
}

this works fine in normal web browsers, but in IE7 the alert is displayed only after clicking on a radio button, then clicking outside somewhere! It fires when it looses focus it appears!

Notice: in the console and previously doing alerts and stuff, I can see that my query selector does in fact select the correct radio buttons.

What is this strange phenomenon?


Solution

  • IE7 doesn't fire the onChange event until the radio button loses focus. Your alternative is to connect to the onClick event.