问题
When i try to trigger an event click with a mobile browser the "click" doesn't work. With Firefox for Desktop works fine.
This is my html:
<li class='brand'></li>
And this is my jquery:
$('.brand').click(function() { alert('ok') });
Can you explain me? Thanks.
回答1:
Use touch events
$(document).on('click touchstart', '.brand', function() {
alert('ok');
});
http://jsfiddle.net/9x9fm/
回答2:
Try to use event delegation here:
$(document).on('click', '.brand', function() {
alert('ok');
});
回答3:
Try to use like this:
$('.brand').on('click' function() {
alert('ok');
});
来源:https://stackoverflow.com/questions/21776570/jquery-mobile-click-event-doesnt-work