IOS部分设备 onclick 没有执行问题

onclick事件在安卓以及pc,还有部分ios设备(ios10.0.2)可以正常使用。但是在ios13不能正常触发。

解决方案:使用ontouchend 或者ontouchstart事件来代替onclick即可正常触发了。

eg:

<div onclick='removePic(this)' ontouchend='removePic(this)'>X</div>

(IOS移动端是 ontouchend ,当然你也可以用 ontouchstart ,两个分别是手指离开屏幕触发和一触碰到就触发。)

原文地址:https://www.cnblogs.com/liuqd001/p/12097833.html