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

131
Views
No se puede usar la tecla "Eliminar" en el campo de entrada de SSN

No puedo usar la tecla "Eliminar" para eliminar caracteres dentro de este campo de entrada de SSN. Si ingresa nueve números, luego usa las teclas de flecha para navegar a una parte de la cadena y presiona el botón Eliminar (no Retroceso), no ocurre el comportamiento esperado. ¿Hay alguna manera de permitir el formato automático del SSN (que es lo que hace el resto del código) y al mismo tiempo permitir que el botón Eliminar se comporte como se esperaba?

 // SSN validation // trap keypress - only allow numbers $('input.ssn').on('keypress', function(event) { // trap keypress var character = String.fromCharCode(event.which); if (!isInteger(character)) { return false; } }); // checks that an input string is an integer, with an optional +/- sign character function isInteger(s) { if (s === '-') return true; var isInteger_re = /^\s*(\+|-)?\d+\s*$/; return String(s).search(isInteger_re) != -1 } // format SSN $('input.ssn').on('keyup', function() { var val = this.value.replace(/\D/g, ''); var newVal = ''; if ((val.length > 3) && (val.length < 6)) { newVal += val.substr(0, 3) + '-'; val = val.substr(3); } if (val.length > 5) { newVal += val.substr(0, 3) + '-'; newVal += val.substr(3, 2) + '-'; val = val.substr(5); } newVal += val; this.value = newVal; });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div id="u22" class="ax_text_field"> <input id="u22_input" class="ssn" type="text" value="" data-label="ssn1" maxlength="11" /> </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!