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
Problem displaying document.body.innerHTML.replace

I add document.body.innerHTML to the page, but the results are displayed incorrectly in the inspect element!

I will add this code:

document.body.innerHTML = document.body.innerHTML.replace(/xxxxxxx/g, 'sssssssssss');

https://i.stack.imgur.com/cmcIW.png

But in the inspect element it shows this code:

document.body.innerHTML = document.body.innerHTML.replace(/sssssssssss/g, 'sssssssssss');

inspect element

Why does this happen?

I use datatables to display in the table, but I want to change the column title to another language

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

0

This is happening because the script is inside the body, so as a result, it is replacing all of that content in the script too. What you could do, is, put all of the front-end contents into a div element with a specific id. Then, get the innerHTML of that div, and it should work.

Have a good day!

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!