If you click on a radio button, IE seems to wait with firing the change event until you leave the button,
which is consistent with the behavior on other input fields (like text), but kinda unintuitive.The following piece of code fixes this behavior for me:
$(function () {
if ($.browser.msie) {
$('input:radio').click(function () {
this.blur();
this.focus();
});
}
});
本文介绍了一个简单的JavaScript代码片段,用于解决IE浏览器中单选按钮点击后改变事件延迟到鼠标离开按钮时触发的问题。通过在按钮点击事件中调用blur和focus方法,可以确保事件立即触发,提升用户体验。
1522

被折叠的 条评论
为什么被折叠?



