skip to Main Content

Html – Extra text node in nodelist?

I have a section element having 3 div parent elements, I want to log section children. <section class="section1"> <div class="parent"> <p class="childP">hello</p> </div> <div class="parent"> <p class="childP">bro </div> <div class="parent-3"> <p class="childP">bro </div> </section> const section = document.querySelector('.section1'); when I…

VIEW QUESTION

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