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

189
Vistas
Input Type Number Validation in JavaScript

Form Validation in JavaScript isn't giving me my expected result.

I have a form and event handler. I don't want the user to be able to type in numbers less than 1 or greater than 100. Currently, the min and max in my html code only limits the numbers while scrolling up or down, but they can still type in invalid numbers and not get any warning.

How can I prevent them from typing in numbers less than 1 or greater than 100. I don't have a submit button, and the examples I have seen online are most effective with a submit button. How can I work around this?

const figure = document.getElementById("figure");
figure.addEventListener("change", (event) => (default_figure = event.target.value));
<div class="col-md-12">
  <input type="number" id="figure" class="form-control " placeholder="Assign Class 
       Limit" min="1" max="100" />
</div>

about 4 years ago · Juan Pablo Isaza
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