feat: add highlight function to emphasize important paragraphs
This commit is contained in:
@@ -24,3 +24,14 @@ const addItem = (a) => {
|
|||||||
newItem.textContent = a;
|
newItem.textContent = a;
|
||||||
list.appendChild(newItem);
|
list.appendChild(newItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ejercicio 4
|
||||||
|
|
||||||
|
const highlight = () => {
|
||||||
|
const paragraphs = document.querySelectorAll('#parrafos p');
|
||||||
|
paragraphs.forEach((p) => {
|
||||||
|
if (p.textContent.toLowerCase().includes('importante')) {
|
||||||
|
p.classList.add('destacado');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user