Created
February 14, 2022 22:57
-
-
Save joelibaceta/fcbdf12a03f29a35b59c3b98f63c98a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
</head> | |
<body> | |
<p> Hola soy un texto </p> | |
<p id="contador">0</p> | |
<ul> | |
<li class="selected"> Elemento 1 </li> | |
<li> Elemento 2 </li> | |
<li class="selected"> Elemento 3</li> | |
<li> Elemento 4 </li> | |
<li class="selected"> Elemento 5 </li> | |
</ul> | |
<p class="selected"> Hola soy otro parrafo </p> | |
<script src="script.js" ></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var parrafo = document.querySelector("p"); | |
parrafo.style.color = "blue"; | |
var items = document.getElementsByClassName("selected"); | |
var contador = document.getElementById("contador"); | |
contador.textContent = items.length | |
for (let e of items) { | |
e.style.color = "red"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment