queryselector get button code example
Example 1: document queryselector click event
const buttons = document.querySelectorAll("#select .button")
for (const button of buttons) {
button.addEventListener('click', function(event) {
//...
})
}
Example 2: dom queryselector
// TO select all the h1 from Html
document.querySelectorAll("h1")
//To select h1 from a particular class or id
document.querySelector(".className/#id h1")