Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

133
Vistas
Input returning as undefined

Having trouble getting started tinkering with JS. Need to have a const be equal to the input field. Then onclick alert the value of the input so I can start working on the functions.

HTML CODE

<!DOCTYPE html>
<html>
  <head>
    <title>Number Checker</title>
    <meta charset="UTF-8" />
    <meta name="keywords" content="HTML, CSS, Javascript" />
    <meta name="description" content="Checks Number" />
    <meta name="author" content="Kaden Stewart" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="CSS/number-checker.css" />
    <script defer src="./Javascript/number-checker.js"></script>
  </head>
  <body>
    <h1>Number Checker!</h1>
   <br>

  </br>
   
    <form name="numberchecker" id="numcheck">
      <label for="number">Input a Number</label>
      <input type="number" id="number" name="number" />
      <button onclick="alert(num)">Check!</button> 
    </form>
  </body>
</html>

JavaScript

const num = document.getElementById("number").value;
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Had to throw the line document.getElementById("numberInput").value; under a function like so.

function Check() {
  const num = document.getElementById("number").value;
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda