<div class="container">
<button>
Olá pessoas!
</button>
</div>
document.querySelector('.container').addEventListener('click', function (event) {
console.log('Container clicado:');
console.log('event.target:', event.target);
console.log('event.currentTarget:', event.currentTarget);
});
document.querySelector('button').addEventListener('click', function (event) {
console.log('Botão clicado:');
console.log('event.target:', event.target);
console.log('event.currentTarget:', event.currentTarget);
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.