Will the onClick event work on touch devices?

I used onclick events on my website. But when I open it in the google chromes browser mode mobile view, nothing happens when touching elements that work with a mouse click. So my question is:

Do I need to add ontouch events along with onclick events or work in onClick when touching all touch screen devices?

PS: Here you can see all my codes: https://github.com/SycoScientistRecords/sycoscientistrecords.imtqy.com/

Or on the website: http://sycoscientistrecords.imtqy.com

And no, I have not tested the site on a real phone.

+6
source share
1 answer

onclick works great on touch screens; I have used it several times and have never experienced any problems.

You can use onmousedown instead of onclick . Or use jQuery to detect taps.

+7
source

All Articles