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

193
Views
¿Puede agregar relleno numérico a un cuadro de entrada de número de arranque?

Si estoy usando un cuadro de entrada, así:

<input type="number" class="form-control" value="00001" />

¿Cómo puedo hacer que al presionar la flecha hacia arriba, cambie a 00002 en lugar de 2 ?

ingrese la descripción de la imagen aquí

¡Gracias!

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

0

"00001" o "00002" no son números, pero si todavía quieres hacerlo, piensa algo como:

Función para agregar ceros a la izquierda (num es valor, tamaño es el tamaño de la cadena)

 function padLeadingZeros(num, size) { var s = num+""; while (s.length < size) s = "0" + s; return s; }

Después:

 $(function() { $("input").change(function(e){ // If the value changes e.preventDefault(); $(this).val(padLeadingZeros($(this).val(), 5)); //replace the value with the returned value of the function, 5 is size. }); });
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!