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

105
Views
Prevent letters from input is not working how I want

I have the following code: https://codepen.io/ion-ciorba/pen/MWVWpmR

The problem is on "Suma solicitata" value, there you can click and edit the value, but when trying to replace a number inside the whole one, the newly replaced number will go to the end of it. How can I fix this, I think it's because of that:

var preventOnlyLetters = function (event) {
                    $(this).val($(this).val().replace(/[^\d]+/, ""));
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It's happening because you are triggering this function both on keypress and keyup. You should only have it on either keyup or keypress. But I think it would be much better if you just make the input type="number"

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!