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

282
Views
¿Cómo puedo reemplazar el texto en varios archivos svg con un código?

Estoy usando el mismo archivo SVG dos veces dentro de la página. Estoy tratando de cambiar un texto dentro de SVG según el idioma de la página. Con el siguiente código, solo cambia el texto en un archivo SVG y el otro no. ¿Qué debo hacer para cambiarlo en todos los SVG?

Código SVG:

 <text id="trading-text" class="text1" dx="0" dy="0" transform="translate(-100,0)" fill="#444351">DEFAULT TEXT</text>

Código JS:

 let text = "CHANGE TEXT"; document.querySelector('[id="trading-text"]').innerHTML= text;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No pude entender lo que realmente quieres decir con archivo svg. ¡Tampoco debe tener más de un elemento con la misma ID! Así que agregue un className como change-text a cada text y use el siguiente código:

 const text = "CHANGE TEXT"; document.querySelectorAll('.change-text').forEach((node) => { node.textContent= text });

Buena suerte.

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!