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

115
Views
Replace all values in a textarea with JS

My problem is that I want to have a small JS application that replaces all the text within a <textarea> HTML tag. I made this small code but it only replaces the first entry:

When I click the button the unicode \u0066 which stands for "f" gets replace but when I have multiple of those like this \u0066 \u0066 \u0066 then it only replaces the first entry and as soon as I click on the button a second time it replaces it the second \u0066 and so on.

Question: Is there a way to apply this method for every character in one button press?

function decodeText() {
  let input = document.getElementById("textInput").value;
  let r1 = input.replace('\\u0066', 'f');
  document.getElementById("textInput").value = r1;
}
<textarea id="textInput"></textarea>

<button onClick="decodeText()">Decode</button>

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

0

function decodeText() {
  let input = document.getElementById("textInput").value;
  let r1 = input.replaceAll('\\u0066', 'f');
  document.getElementById("textInput").value = r1;
}
<textarea id="textInput"></textarea>
<button onClick="decodeText()">Decode</button>

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!