[英]Jquery mobile click event doesn't work
When i try to trigger an event click with a mobile browser the "click" doesn't work. 当我尝试使用移动浏览器触发事件时,“单击”不起作用。 With Firefox for Desktop works fine.
使用Firefox for Desktop工作正常。
This is my html: 这是我的HTML:
<li class='brand'></li>
And this is my jquery: 这是我的jquery:
$('.brand').click(function() { alert('ok') });
Can you explain me? 你能解释一下吗? Thanks.
谢谢。
Use touch events 使用触摸事件
$(document).on('click touchstart', '.brand', function() {
alert('ok');
});
Try to use event delegation here: 尝试在此处使用事件委派:
$(document).on('click', '.brand', function() {
alert('ok');
});
Try to use like this:
$('.brand').on('click' function() {
alert('ok');
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.