Would onClick event work on touch on touch-screen devices?

前端 未结 2 1707
天命终不由人
天命终不由人 2020-12-04 01:28

I\'ve used onclick events in my website. But when I open it in google chromes\' developer mode\'s mobile view, nothing happens on touch on the elements which wo

2条回答
  •  时光说笑
    2020-12-04 02:22

    onclick works fine on touchscreens; I've used it several times and have never had any problem.

    You could consider using onmousedown instead of onclick. Or use jQuery to detect taps.

提交回复
热议问题