For Example : I have the following code
<div class="set">
<button class = "w drum"> w </button>
<button class = "a drum"> a </button>
<button class = "s drum"> s </button>
<button class = "d drum"> d </button>
<button class = "j drum"> j </button>
<button class = "k drum"> k </button>
<button class = "l drum"> l </button>
</div>
Now I want to select all button tags and perform .addEventListener function in all buttons .I implement it by for loop. But I wanna ask is there any way that we can implement it through the following way...
document.querySelectorAll("button")[0,1,2,3,4,5,6].addEventListener("click",pressButton);