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');

});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​


__________________________________________________________________________________

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

你要保守你心,胜过保守一切。

作者:刘俊涛的博客​​