IE8下不支持jquery绑定的click事件怎么破?



 $('#div').on('click',function(){
    doSomething();
})


 <div id="div"></div>

jquery ie8兼容性 HTML JavaScript

神腿蓋世中正 8 years, 9 months ago

jQuery版本?试试1.x?

kamite answered 8 years, 9 months ago

你div里都没内容,怎么点?

我练功发自内心 answered 8 years, 9 months ago

应该你的Div中没有内容点不到吧,没有内容应该是0X0的div是点不到的,你可以用函数触发一下试试后面写个


 $("#div").click();

看看能不能触发
jQuery1.X.X版本才支持IE678

volcano answered 8 years, 9 months ago

莫非应该这么写
$(document).on('click','#div',function(){


 do();

});

Amakura answered 8 years, 9 months ago

估计是IEtester的问题

NP.梦魇 answered 8 years, 9 months ago

可能原因:该元素是隐藏的。
改写成事件委托试试呢。

old77 answered 8 years, 9 months ago

采用1.9版本的jquery
或者抛弃ie,提示用户采用高版本浏览器

诚哥的爪牙 answered 8 years, 9 months ago

楼主不说明使用版本,猜测可能是版本的问题。

复制一段 jQuery 官网的原话:

jQuery 2.x has the same API as jQuery 1.x, but does not support
Internet Explorer 6, 7, or 8.

2.x 版本不兼容 IE6,7,8

404011 answered 8 years, 9 months ago

Your Answer