Inicio de la clase 9 #9
21
clase-9.js
21
clase-9.js
@@ -30,3 +30,24 @@ listaItems.addEventListener('click', function(event) {
|
||||
});
|
||||
item.classList.add('seleccionado');
|
||||
});
|
||||
|
||||
// Ejercicio 4 - Bubbling y capturing
|
||||
const externo = document.getElementById('externo');
|
||||
const interno = document.getElementById('interno');
|
||||
const botonCaptura = document.getElementById('botonCaptura');
|
||||
|
||||
externo.addEventListener('click', function() {
|
||||
console.log('bubbling: externo');
|
||||
});
|
||||
|
||||
interno.addEventListener('click', function() {
|
||||
console.log('bubbling: interno');
|
||||
});
|
||||
|
||||
botonCaptura.addEventListener('click', function() {
|
||||
console.log('bubbling: button');
|
||||
});
|
||||
|
||||
externo.addEventListener('click', function() {
|
||||
console.log('capturing: externo');
|
||||
}, true);
|
||||
|
||||
Reference in New Issue
Block a user