I'm using this code, but it's not catching. I want to increment with each click on the "Increment" button.
Code:
function incrementar(){
for (let i =0; i<10; i++){
document.getElementById("incrementar2").innerHTML = i;
}
}
<html>
<body>
<button onClick="incrementar()">
Incrementar
</button>
<div id="incrementar2"> 0
</div>
</body>
</html>
But it's not going at all, it goes straight to number 9. Can anyone help me?