Created
November 12, 2018 04:41
-
-
Save camilomontoyau/c2af00396213dd25f10ccac11514db92 to your computer and use it in GitHub Desktop.
react es JS
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> | |
<body> | |
<div> | |
<div>PROP: <span>hola soy un texto estático</span></div> | |
<div>ESTADO: <span id="clicks">0</span></div> | |
<button id="boton">click acá</button> | |
</div> | |
<script type="text/javascript"> | |
const clicksElement = document.getElementById('clicks'); | |
const boton = document.getElementById('boton'); | |
console.log(clicksElement); | |
function cambiarClicks() { | |
let numeroClicks = parseInt(clicksElement.innerText); | |
console.log('numeroClicks', numeroClicks); | |
numeroClicks++; | |
clicksElement.innerText = numeroClicks.toString(); | |
} | |
boton.onclick = cambiarClicks; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment