Jquery click event does not work on li in devices (ipad, iphone ..)

Jquery click event does not work on li in devices. I tried using click and touchstart events, but the problem with using touchstart I could not scroll down the div. When I try to scroll down by pressing the li button, it will be selected. Is there a way to select and scroll li using any jquery events rather than jQuery mobile events?

$('#liId').on({ 'touchstart' : function(){ console.log('Event Fired'} }); 
+6
source share
3 answers

The problem was resolved when I added a style class to all li.

.liClass {cursor: pointer; }

+8
source

replace : with , and expand {} before clicking "touchstart"

 $('#liId').on( 'touchstart', function(){ console.log('Event Fired'); }); 
0
source

in your css file

 #liId { cursor : pointer; } 

JQuery

 $('#liId').click(function(){ alert('Event Fired'); }); 
0
source

Source: https://habr.com/ru/post/956046/


All Articles