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
文章来源:刘俊涛的博客 欢迎关注公众号、留言、评论,一起学习。
__________________________________________________________________________________
若有帮助到您,欢迎点击推荐,您的支持是对我坚持最好的肯定(*^_^*)