此函数在 firefox/chrome 中触发:
$(document).on("reset", "form", function(){
alert("working");
});
IE 有哪些替代品(我安装了 8 个,所以我想让它从 8 个开始工作)。
最佳答案
尝试将事件处理程序直接附加到您的表单:
$(document).ready(function(){
$("form").bind("reset", function(e) {
alert("working");
});
});
这apparently works适用于包括 IE8 在内的多种浏览器。
由于 IE8 处理事件传播的方式,您的方法可能无法正常工作... 来自 jQuery documentation :
In Internet Explorer 8 and lower, the paste and reset events do not bubble. Such events are not supported for use with delegation, but they can be used when the event handler is directly attached to the element generating the event.
关于javascript - 表单重置事件不会在 IE 中触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13436887/