Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Add event listener to multiple buttons with the same class

btns = document.getElementsByClassName("saveBtn");
    for (var i = 0; i < btns.length; i++) {
        btns[i].addEventListener("click", function () {
			//Add function here
        });
    }
Source by www.thiscodeworks.com #
 
PREVIOUS NEXT
Tagged: #Add #event #listener #multiple #buttons #class
ADD COMMENT
Topic
Name
6+8 =