Use click & touch events the easy way
If you want to use touch
events when available, use this tiny script :
var clickEvent = "createTouch" in document ? "touchend" : "click"
// and then
$(myElement).on(clickEvent, ...)
myElement.addEventListener(clickEvent, ...)
myElement.listen(clickEvent, ...)
Written by Matthias Le Brun
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Js
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#