Here’s how to create an EventListener without JQuery…
[].forEach.call(document.querySelectorAll('.element'), function (el) {
el.addEventListener('click', function() {
// Your code
}, false);
});
Documentation: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener
This article is also interesting: http://blog.romanliutikov.com/post/63383858003/how-to-forget-about-jquery-and-start-using-native
2
solved i need to create an event listener. but i dont want to use any framework