6

Jquery click event is not working on li in devices. I tried using click and touchstart events, but the problem when touchstart used is I couldn't scroll down the div. When I try to scroll down by clicking an li, it gets selected. Is there any way to select and scroll li using any jquery events rather than jquery mobile events?

$('#liId').on({ 'touchstart' : function(){ console.log('Event Fired'} });
Praveen
  • 55,303
  • 33
  • 133
  • 164
ABHILASH SB
  • 2,122
  • 2
  • 21
  • 31

3 Answers3

9

The issue is solved when I added a style class to all li.

.liClass { cursor : pointer; }

ABHILASH SB
  • 2,122
  • 2
  • 21
  • 31
1

replace : with , and unwrap {} before 'touchstart'

$('#liId').on( 'touchstart', function(){ 
 console.log('Event Fired');
});
Praveen
  • 55,303
  • 33
  • 133
  • 164
  • Well I tried that too...I'm getting the event, but I couldn't scroll the div.When the event is fired the li which fired the touchstart event gets selected. – ABHILASH SB Oct 16 '13 at 06:06
  • @ABHILASHSB check the css of that items. I doubt the problem is there – Praveen Oct 16 '13 at 06:07
0

in your css file

#liId { cursor : pointer; }

jQuery

$('#liId').click(function(){
    alert('Event Fired');
});
BritishSam
  • 1,070
  • 8
  • 24