Inicio con ejercicios repaso del primer cuatrimestre #3
@@ -1 +1,11 @@
|
||||
// Agregar aquí el código javascript
|
||||
const listaItems = document.getElementById('lista-items');
|
||||
|
||||
listaItems.addEventListener('click', (event) => {
|
||||
const item = event.target;
|
||||
|
||||
if (item.tagName.toLowerCase() !== 'li') {
|
||||
return;
|
||||
}
|
||||
|
||||
item.classList.toggle('seleccionado');
|
||||
});
|
||||
@@ -1,2 +1,7 @@
|
||||
/* Agregar el código CSS necesario para el ejercicio */
|
||||
|
||||
.seleccionado {
|
||||
background-color: yellow;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,22 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Ejercicio 3</title>
|
||||
<link rel="stylesheet" href="estilo.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Ejercicio 3</h1>
|
||||
|
||||
<ul id="lista-items">
|
||||
<li>Zapatos nuevos</li>
|
||||
<li>Leer un capítulo</li>
|
||||
<li>Comprar frutas</li>
|
||||
<li>Enviar el informe</li>
|
||||
<li>Escuchar música</li>
|
||||
<li>Practicar JavaScript</li>
|
||||
</ul>
|
||||
|
||||
<script src="ejercicio3.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user