How to make my 'click' function work with iOS

前端 未结 5 1721
面向向阳花
面向向阳花 2020-11-28 11:53

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:



        
5条回答
  •  失恋的感觉
    2020-11-28 12:38

    You can use this:

    $('button').bind( "touchstart", function(){
        alert('hi');
    });
    

    Another Solution is to set the element's cursor to pointer and it work with jQuery live and click event. Set it in CSS.

提交回复
热议问题