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

146
Views
¿Cómo insertar un espacio después de que el usuario escriba el carácter de barra inclinada (/) dentro de un campo de entrada editable de contenido?

Por lo que he visto hasta ahora aquí en stackoverflow, hay algunas recomendaciones sobre la función String.replaceAll() o el uso de javascript con el ID de entrada. El siguiente código introducirá un espacio después de cinco caracteres, pero lo necesito para agregar el espacio después de escribir el carácter de barra inclinada.

 document.getElementById('target').addEventListener('input', function (e) { var target = e.target, position = target.selectionEnd, length = target.value.length; target.value = target.value.replace(/\s/g, '').replace(/(\d{5})/g, '$1 ').trim(); target.selectionEnd = position += ((target.value.charAt(position - 1) === ' ' && target.value.charAt(length - 1) === ' ' && length !== target.value.length) ? 1 : 0); }); <label id="target" contenteditable="true" type="text"/>someText</label>

Agradezco cualquier orientación.

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!