Last Updated: February 25, 2016
·
1.161K
· novalagung

Javascript - Creating jQuery-like selector and event add listener

var $ = document.querySelectorAll.bind(document);
Element.prototype.on = Element.prototype.addEventListener;

$('#somelink')[0].on('touchstart', handleTouch);