Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make my 'click' function work with iOS

Tags:

jquery

ios

I have a set of Div's which act as buttons. These buttons have a simple jquery click() function which works in all browsers except iOS.

For example:

<div class="button">click me</div>

and

$('.button').click(function(){

   alert('hi');

});

I'm not sure why this doesn't work on iOS - clearly there is no 'clicking' in iOS.

Unfortunately I don't have an iphone device to test this myself, but I'm getting a lot of complaints from my clients who want to click things and nothing is happening.

What is the key to getting this working?

like image 956
willdanceforfun Avatar asked May 14 '12 05:05

willdanceforfun


1 Answers

Click ": means When a mousedown and mouseup event occur on the same element OR an element is activated by the keyboard.

from Jquery Bug, there is work around , Just add "cursor: pointer" to the element's CSS and the click event will work as expected. and you can even see this Jquery click on Ios for help

like image 139
Ravi Gadag Avatar answered Nov 06 '22 21:11

Ravi Gadag