-2
I’m not getting value from input
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Index</title>
</head>
<body>
<input type="text" id="numero">olaa</input>
<button onclick="enviar()">mostrar</button>
<p id="par"></p>
<script>
var par = "";
var numero = document.getElementById('numero').value;
function enviar() {
par = document.getElementById('par').innerHTML = numero.value;
}
</script>
</body>
</html>
thanks for the answer, but my biggest problem was the following: I put the input after captured in a variable and then I put it for when the button was clicked it alerts the variable but always gave: NAN or Undefined or 0 or nothing
– Uuyt Judji
Yes, this happened before because the "number" variable assignment is outside the send function. That is, you didn’t "capture" the input value.
– Lucas Módolo