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

86
Views
Cómo insertar HTML adyacente entre 2 divs diferentes

Necesito obtener mi div entre 2 divs dentro de mi plantilla. Solo puedo editarlo con HTML externo, JS. La plantilla se ve así:

 <main id="content-in"> <div id="homepage-banner"> XXX </div> <div id="carousel-banner"> XXX </div>

Y necesito obtener mi img y un href <div id="moveOut"> XXX </div> entre estos 2.

Lo tengo así ahora que funciona bien:

 <script> function addCode() { var d1 = document.getElementById('content-in'); d1.insertAdjacentHTML('afterbegin', '<div id="moveOut"><a href="https://example.com/"><img src="https://example.png" alt=""></a></div>'); } </script>

pero necesito moverlo. Gracias por tu ayuda.

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

0

Debe insertar después del DIV homepage-banner .

 var d1 = document.getElementById("homepage-banner"); d1.insertAdjacentHTML('afterend', '<div id="moveOut"><a href="https://example.com/"><img src="https://example.png" alt=""></a></div>');
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!