willdanceforfun willdanceforfun - 10 months ago 24
Javascript Question

How to make my 'click' function work with 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>





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?


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