In HTML, button cannot be a descendant of button
Backlinks (1)
Comments (0)
function findNestedButtons(element = document.body) { const buttons = element.querySelectorAll("button"); buttons.forEach((button) => { const nestedButtons = button.querySelectorAll("button"); if (nestedButtons.length > 0) { console.log("Found nested button:", button); console.log("Nested buttons:", nestedButtons); } });}
findNestedButtons();