The goal is to fire an event by clicking on an element, which would create a new element with the same tag, classes and event listener to create another element of the same kind...
const btn = document.querySelectorAll("button");
btn.forEach((b) =>
b.addEventListener("click", function () {
console.log("Boom!");
b.insertAdjacentHTML("afterend", "<button class='button'>Boom</button>");
})
);
<button class="button">Boom</button>
However, when a new element is dynamically created it lacks event listener despite apllying .querySelectorAll and .forEach. So how would I dynamically create elements with event listeners?