-1
I created a home screen where you put the value you want to be displayed on the table. However, when you click the button it jumps to another screen.. wanted him to display on the same screen that is already stylized.
How can I do it? I’m using Document.write...
Code:
<div class="calculadora">
<h1>Digite o número que deseja saber a tabuada :</h1> <input type="text" maxlength="2" id="txtNumero">
<button onclick="calcular()">Calcular</button>
<div id="resultado">
</div>
</div>
<script>
function calcular() {
numero = document.getElementById("txtNumero").value;
for (i = 0; i < 11; i++) {
document.write(`<br>${numero} X ${i} = ${numero * i} <br>`);
}
}
</script>
I really appreciate @user140828 gave exactly how I wanted it. I will study a little more about innerHTML. First time I’m using the stack overflow and it was really good. I will help the community too.
– Danilo Vasconcelos