Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

116
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda