//search elements const starter_button = document.querySelectorAll(".starter-batton"); [].forEach.call( starter_button, function(el) { //hang event el.onclick = function(e) { alert('yeah') } });
Hang event on all elements by class. Javascript
Approved. Code works!
This is exactly the working code that is verified by the moderator or site administrators