I know this function:
document.addEventListener('touchstart', function(event) {
alert(event.touches.length);
}, false);
But is it possible to add this to a div? Example:
document.getElementById("div").addEventListener('touchstart', function(event) {
alert(event.touches.length);
}, false);
I haven't tested it yet, maybe some of you know if it works?
Yeah, that's how you do it.
Or with jQuery
Of course, let's assume you have to insert text in h1 element when a user clicks on the button. It's pretty easy to bind HTML's specific element to addEventListener() method
The other way round if you are not using addEventListener, probably a alternative to get control over ID.