skip to Main Content

Javascript – Why does querySelectAll return empty NodeList even though there should be three buttons?

I'm trying to add event listeners to all buttons in my program, but const buttons = document.querySelectorAll('.button'); returns an empty NodeList. HTML: <div id="buttons" class="buttons"> <button type="button" class="button" id="send">Send</button> <button type="button" class="button" id="delete">Delete</button> <button type="button" class="button" id="again">Again</button> </div> JS: const…

VIEW QUESTION
Back To Top
Search