jQuery .on() and .delegate() doesn't work on iPad

后端 未结 7 778
北荒
北荒 2020-12-05 04:38

If you try this snippet on desktop, everything works.
Whenever you try it on iPad, it won\'t do anything.

7条回答
  •  一个人的身影
    2020-12-05 05:03

    On iOS there is no event bubbling without a cursor style.
    So in your CSS you need to add cursor: pointer; to the element.

    $('body').on('click', '#click', function() {
        alert("This alert won't work on iPad");
    });
    #click { 
      font-size: 24px; 
      cursor: pointer;
    }
    
    
    Click here

    I know it been asked a long time ago, but I thought a simple CSS solution might help.

提交回复
热议问题