Wednesday, March 13, 2013

Fix IE8 onchange event

Yeah...IE8...Just doesn't want to recognize onchange on a radio or checkbox until the field loses focus.

Bad.  Very bad.

Found some code here and adapted it to into my XPage using a class selector for jQuery and it works like a champ.

Though this might be helpful to someone else.



<xp:scriptBlock id="scriptBlock1"><script>

if ($.browser.msie &amp;&amp; $.browser.version==8) {
    $(function() {
      $('.answer2Class').click(function() {
        this.blur();
        this.focus();
      });
    });
  }

</script>
</xp:scriptBlock>