I have no idea of how to do this, I want to pass an argument to the callback function "ctrlDeleteItem":
document.querySelector('.container').addEventListener('click', ctrlDeleteItem);
But if I do that, I lose access to the event property, example:
document.querySelector('.container').addEventListener('click', ctrlDeleteItem(item));
function ctrlDeleteItem(item, event) {
return function() {
console.log(item);
console.log(event);
}
}
How can I still pass the event as a parameter? I can't find how to do it, thanks.