关于jquery中on绑定click事件在苹果手机中的兼容性问题 关于jquery中on绑定click事件在苹果手机中的兼容性问题

关于jquery中on绑定click事件在苹果手机中的兼容性问题

jquery中on绑定click事件在苹果手机失效的问题,在PC端测试正常,在安卓手机也是正常,就到了苹果手机就不行了.

例如在这样的Dom结构中:<div class="am-btn am-btn-default sure-btn" id="sure_id">确定</div>

在js中是这样的:$("body").on("click","#sure_id",function(){ console.log("点击了"); });

这时候在苹果手机上访问时会出现点击按钮是无效,然而在安卓手机中测试则是正常情况,让人不解,

解决这一奇葩问题的方法是对于点击的对象,使用cursor:pointer这个样式的设置,<style> .sure-btn{ cursor:pointer }</style>,

这样的一个小bug就此解决!

评论 0