jquery.click() not working in iOS

IOS点击click不生效;

Try to add a pointer cursor to the button and use .on to bind the click event.

$('#button1').css('cursor','pointer');

$(document).on('click', '#button1', function(event) {

event.preventDefault();

alert('button1');

});

 

或者:

JS

const IS_IOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;

 

if (IS_IOS) {

document.documentElement.classList.add('ios');

}

CSS

.ios,

.ios * {

// causes dom events events to be fired

cursor: pointer;

}

参考:

https://stackoverflow.com/questions/15095868/jquery-click-not-working-in-ios

 

文章来源:刘俊涛的博客 欢迎关注公众号、留言、评论,一起学习。

__________________________________________________________________________________

若有帮助到您,欢迎点击推荐,您的支持是对我坚持最好的肯定(*^_^*)

耶和华是我的牧者,我必不至缺乏。
原文地址:https://www.cnblogs.com/lovebing/p/15324416.html