[英]JQuery live not working on IE
$('.enter').live('click', function (e) {
e.preventDefault();
});
for some reason this does not get called on the specified button, BUT, when f12 is pressed and developer tools pops up this works!? 由于某些原因,当按f12键并弹出开发人员工具时,此操作不会在指定的按钮BUT上被调用! I am using live on all other elements and it works fine... very strange and hard to debug.
我在所有其他元素上都使用了live,并且工作正常……非常奇怪且难以调试。 any help much appreciated!
任何帮助,不胜感激!
If you are using jQuery 1.7+, it may be better that you use .on()
. 如果您使用的是jQuery 1.7+,那么最好使用
.on()
。 For example : 例如 :
$(document).on('.enter', 'click', function(){
...
});
As jquery doc said .live()
is deprecated http://api.jquery.com/live/ 如jquery doc所说,不推荐使用
.live()
http://api.jquery.com/live/
I had some issue by using .live()
on IE if the element is created after define the event. 如果元素是在定义事件后创建的,则在IE上使用
.live()
遇到一些问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.