Cause of the problem: clicking an invalid (unable to execute) problem description for the Click event that was bound with the jquery live method during the public number development (micro-site) process
When a delegate is used to add an event to an element, the event click
is invalidated if the event is delegated to document
or body
on, and the element of the delegate is not clickable by default (such as div
, span
etc.) click
.
Solutions
There are 4 solutions to choose from:
- ?
click
bind the event directly to the target? IE .target
) on
- Change the target element to
<a>
a clickable element button
?
- ?
click
delegate events to????? Non- document
or body
the?? On the parent element
- Add a style rule to the target element
cursor: pointer;
? recommend the latter two. From the perspective of the solution, it is speculated that in Safari, a click event of a non-clickable element does not bubble to the parent element. By adding, the cursor: pointer
element becomes clickable.
Reference: https://happycoder.net/solve-ios-safari-click-event-bug/
The click-to-click event Invalidation solution in IOS Safari