关于radio的onchange事件在IE、google中操作不一样的问题

来源:互联网 发布:关节机器人编程 编辑:程序博客网 时间:2024/06/10 19:29
<input type="radio" name="cmppProducts.isgive" id="isgive" value="1" checked="checked"  onchange="changeIsgive()" />是<input type="radio" name="cmppProducts.isgive" id="isgive" value="2"  onchange="changeIsgive()" />否

在不同浏览器出现不一致的操作,主要代码是上面的。在google浏览器可以正常点击触发操作changeIsgive()函数,但是在IE11不能,选中radio后失去焦点后需要在空白处点击下才会触发changeIsgive()函数操作

解决方法:在保留onchange的前提下,在onclick里面调用radio的blur()方法。加上onClick=”this.blur();”即可解决

0 0
原创粉丝点击