0
I’m having trouble using the getElementById
.
When I run my code and click on the button, apparently the value entered in the input
is not received.
Can someone help me?
var teste1 = document.getElementById("teste").value;
var button = document.querySelector("button");
button.onclick = document.write(teste1);
<input id="teste"/>
<button>Testar</button>
The
onclick
should call a function.– Sam
What do you mean the value is not received? Who should receive this value? Your problem is the
getElementById
?– viana