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

170
Views
¿Cómo agregar color de fondo a la prueba en la página web?

Encontré un texto en la página web usando el siguiente código

 document.body.innerText.indexOf('tested') document.body.innerText.includes('tested')

después de encontrar el texto, quiero aplicar el color de fondo a ese texto.

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

0

Encuentre la referencia del elemento con su texto interno:

 let xpath = "//div[text()='tested']"; let element = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;

Reemplace div con cualquier tipo de elemento que tenga donde esté presente el texto

Puede cambiar directamente el estilo una vez que tenga la referencia del elemento:

element.style.backgroundColor = "red";

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!