Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

188
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!