mercredi 4 novembre 2015

IE does not fire 'Change' event on indeterminate checkbox when you click on it

i have a tri-state checkbox and i need the change event to be fired when the user clicks on it but the IE won't fire it when the checkbox's state is on "INDETERMINATE" (browser bug maybe?).
As work around for IE i could trigger the change event programmatically but this doesn't work for my case because i need to know if the event was fired because the user actually clicked on it.

Fiddle here / Test on IE and Chrome

<label for="cb">
  <input id="cb" type="checkbox" />
   click me
</label>

var checkbox = document.getElementById("cb");
checkbox.indeterminate = true;
$('#cb').change(function(){alert('Change Event')});

I have read this article http://ift.tt/1Wz5VXo and How to deal with browser differences with indeterminate checkbox but i could find a specific resolution for my case.

Any ideas how to fix this?

Thank you in advance.




Aucun commentaire:

Enregistrer un commentaire