How to bind click event in iOS?

I'm just trying to bind the click event with <button>and make it work on the desktop (chrome, FF, ...), android and iOS.

I tried a lot of things like this cursor: pointer , which seemed the simplest and most effective, but didn't work.

I also tried onclick=''or onclick='void(0)'in the HTML element, the trick I saw, I don’t even remember where ...

I tried with external libraries such as FastClick to remove up to 300 ms after a click ... Doesn't work

And no more chances with Polyfill Pointer Events and binding with pointerup...

I'm out of ideas ...

My HTML:

<div class="col-md-12">
    <button type="button" onclick='' id="begin" class="btn andro btn-danger btnlg">
        <img src="img/icon.png" height="50px"> GO
        <img src="img/icon.png" height="50px">
    </button>
</div>

My JS:

  $(document).on('touchstart', '#begin', function() {
      // do things
  });

, , touchstart ( touchend!) click iphones...

, iphone , , iOS... ... ? ^^

+4
1

Soooo.... , ...

, ... , :

$( document ).ready(function() {
    // My bindings here
});

, iOS ...

, ... , -!

+1

Source: https://habr.com/ru/post/1672897/


All Articles