Capture "tap" event with pure JavaScript

javascript

Solution

The `click` event is triggered on mouse click as well as on a touch click.

The `touchstart` event is triggered when the screen is touched.

The `touchend` event is triggered when the touch ends. If the default action is prevented, a `click` event will not trigger.

http://www.w3.org/TR/touch-events/

Problem

How can I capture a user's "tap" event with pure JS? I cannot use any libraries, unfortunately.

Original source