JSFiddle - React, Tailwind, and code Playground
by feklee
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Button Test</title>
</head>
<body>
<button class="button">Button</button>
</body>
</html>
JavaScript
var el = document.querySelector('.button'),
onClick, onTouchEnd, onTouchMove;
onClick = function () {
alert('Button was clicked. 2');
};
onTouchEnd = function (e) {
e.preventDefault();
alert('touchend');
};
onTouchMove = function (e) {
e.preventDefault();
};
window.addEventListener('touchmove', onTouchMove);
window.addEventListener('touchend', onTouchEnd);
window.addEventListener('touchcancel', onTouchEnd);
el.addEventListener('click', onClick);