Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

117
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda