jquery.ui.touch.punch.js script is preventing input functionality on touch devices

前端 未结 9 1512
一个人的身影
一个人的身影 2021-02-01 06:38

It took me a little bit, but I figured out that I can\'t click on my inputs because of the touch.punch script I\'m using to enable jquery UI drag functionality on touch devices.

9条回答
  •  情歌与酒
    2021-02-01 07:05

    Jacob's answer worked with a slight modification—I found that using the click event resulted in inconsistent behavior on iPad, ios9 Safari. Sometimes I'd press once on a field and it would focus, other times I had to press three times. Changing click to touchstart solved the problem for me (I also used event delegation since my form was added dynamically):

    $('form').on('touchstart', 'input,textarea',function(){
        $(this).focus();
    });
    

提交回复
热议问题