0

I am try to implement handling multiple touch listener and key listener in java script .Can anybody tell how to handle?

I have tried this way it is not working

document.body.addEventListener('touchstart','touchend','keypress' function(e){

Thanks

Nikhil Aggarwal
  • 28,197
  • 4
  • 43
  • 59
user386430
  • 4,837
  • 13
  • 41
  • 45
  • @4dgaurav that is not what OP is asking.... – epascarello Nov 03 '15 at 14:10
  • `function addEvents(el, events, fn) { events.forEach(function(e) { el.addEventListener(e, fn, false); }); }` and call this as `addEvents(document.getElementById('id'), ['click', 'keyup', 'touchend'], handler);` – Tushar Nov 03 '15 at 14:14

0 Answers0