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

274
Views
¿Cómo hacer que solo se pueda escribir un número entero en el cuadro?

Quiero hacer que solo se pueda escribir 1 número en el cuadro (el máximo es el número 8). ¿Hay alguna manera de hacerlo?

 <label class="control-label col-sm-4" for="seal_qty">Seal Quantity:</label> <div class="col-sm-4"> <p class="form-control-static" style="margin-top: -6px;"> <input type="number" class="form-control" id="seal_qty" name="seal_qty" min="1" max="8" placeholder="Enter Seal Quantity" value="<?php echo $seal_qty; ?>"> </p> </div> <div class="col-sm-10"></div> var seal_qty = document.translot.seal_qty.value; if (seal_qty == null || seal_qty ==""){ alert("Seal Quantity should not be blank."); return false; }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede verificar la lenght y el número como:

 const seal_qty = document.querySelector('#seal_qty'); seal_qty.addEventListener('change', (e) => { const input = e.target; const value = parseInt(input.value); if(value.length > 1 || value > 8){ input.value = ''; alert("maximum is 8."); } });
 <label class="control-label col-sm-4" for="seal_qty">Seal Quantity:</label> <div class="col-sm-4"> <p class="form-control-static" style="margin-top: -6px;"> <input type="number" class="form-control" id="seal_qty" name="seal_qty" min="1" max="8" placeholder="Enter Seal Quantity"> </p> </div> <div class="col-sm-10"></div>

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!