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

219
Views
El atributo mínimo de entrada de número no funciona con flotantes

Con el siguiente HTML, cuando escribo el valor 3 en la entrada y hago clic en submit , Chrome (al menos) muestra el siguiente error en una ventana emergente:

 Please enter a valid value. The two nearest valid values are 2.0001 and 3.0001.

Esto no tiene sentido. Establecí el valor mínimo en 0.0001 y estoy ingresando 3 que es mayor que 0.0001 .

 document.getElementById('form').onsubmit = function(e) { e.preventDefault() }
 <form id="form"> <input placeholder="0.000" id="something" type="number" name="something" min="0.0001" required> <button type="submit">submit</button> </form>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El valor predeterminado para el atributo de step es 1 , y dado que tiene un min aplicado en su entrada, no hay una integral n tal que min + n * step ( 0.0001 + n * 1 ) sea igual a 3 .

Puede cambiar el paso a 0.0001 o any .

 document.getElementById('form').onsubmit = function(e) { e.preventDefault(); console.log(e.target.elements[0].value); }
 <form id="form" onsubmit="onSubmit"> <input placeholder="0.000" id="something" type="number" name="something" min="0.0001" step="any" required > <button type="submit">submit</button> </form>

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