The ontouchcancel
property of the GlobalEventHandlers
mixin is an event handler that processes touchcancel
events.
var cancelHandler = someElement.ontouchcancel;
This example shows two ways to use ontouchcancel
to set an element's touchcancel
event handler.
<html>
<script>
function cancelTouch(ev) {
}
function init() {
let el = document.getElementById('target1');
el.ontouchcancel = cancelTouch;
}
</script>
<body onload="init();">
<div id="target1"> Touch me ... </div>
<div id="target2" ontouchcancel="cancelTouch(event)"> Touch me ... </div>
</body>
</html>