web-profile

jQuery click issue on iPhone/iOS

By default jQuery click event does not work in iPhone/iOS devices in Safari/Chrome for a non-anchor element.

Ways to fix it:

  • add {cursor:pointer} CSS property to a clickable element;
  • or add onclick="void(0)" HTML attr;

And also don't forget href attr for the anchor element, otherwise it will be not trigger click event in iPhone/iOS devices also.

One of these conditions needs to be met for iOS browsers to generate click events from touch-events:

  • The target element of the event is a link or a form field.
  • The target element, or any of its ancestors up to but not including the , has an explicit event handler set for any of the mouse events. This event handler may be an empty function.
  • The target element, or any of its ancestors up to and including the document has a cursor: pointer CSS declarations.

Leave a Reply

Your email address will not be published.