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

82
Views
Replace next 14 characters with X after the first 10 characters

I have a span tag with 34 randomly generated letters and numbers. I will like 14 characters after the first 10 characters to be replaced with X. Please how can this be done with javascript? Thanks.

From This:

<span>1KThBTGGQgT7VsZjYSgucdHMCUJrw5UdrJ</span>

To This: 1KThBTGGQgxxxxxxxxxxxxxxCUJrw5UdrJ

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

0

you can probably also do this with regex which might be a better solution

//To This: 1KThBTGGQgxxxxxxxxxxxxxxCUJrw5UdrJ

let text = document.querySelector('span')

let left = text.innerText.substr(0,10)
let center = "xxxxxxxxxxxxxx"
let right = text.innerText.substr(24)

let newText = left + center + right

text.innerText = newText
<span>1KThBTGGQgT7VsZjYSgucdHMCUJrw5UdrJ</span>

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!