Ein weiteres Beispiel in der JavaScript -Ereignisdelegation
function delegate(el, selector, fn)
{
el.addEventListener("click", function(){
if(event.target.matches(selector))
{
fn()
}
})
}
window.onload = function(){
let first = document.getElementById("first");
delegate(first, "button", function(){alert("DFREXXXXXXXXX")});
}
Javasper