关于jquery中on绑定click事件在苹果手机失效的问题(巨坑啊)

用一个div当做了一个按钮来使用。

<div class="button">
    <div class=" next_button button_left btn_red" style=" 345px;">
    下一步
    </div>
</div>    

因为是动态添加的内容,所以想要使用click事件,需要给他用on绑定一下:

$(document).on("click",".next_button",function(){
    alert();
});

这个时候,使用苹果手机访问的时候,发现了一个坑爹的问题,如论如何点击“下一步”,都没有任何反应,可是在安卓和各种模拟器中一切正常。后来经过查找资料才知道,苹果有这么个设置:
对于点击的对象,拥有cursor:pointer这个样式的设置,也就是说,鼠标放上去,能够出现“手”型的图标才被认作可以使用点击事件,于是果断增加了样式

<style>
    .next_button{
        cursor:pointer
    }
</style>


---------------------

原文:https://blog.csdn.net/yuexiage1/article/details/51612496

原文地址:https://www.cnblogs.com/lxwphp/p/15453613.html