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

114
Views
Inserte la etiqueta html y la etiqueta de script dinámicamente desde javascript

Básicamente, estoy tratando de agregar dinámicamente algo de html y script desde javascript. Pero la secuencia de comandos que se agrega desde javascript no se invoca ni se llama durante la representación del html base.

 <html> <head> </head> <body> <div id="container" style="width:100vw;height:100vh;position:relative;"></div> <script type="text/javascript"> ! function() { var ht = '<script src=\'https:\/\/www.googletagservices.com\/dcm\/dcmads.js\'><\/script>' var target= document.getElementById("container"); var newScript = document.createElement("div"); newScript.innerHTML = ht target.appendChild(newScript); }(); </script> </body> </html>

He intentado con innerHtml y appendChild y ambos parecen no funcionar. Quiero agregar una etiqueta HTML completa (incluido el script que no se puede cambiar) en la variable ht . ¿Cómo podemos agregar cualquier script HTML desde javascript y renderizarlo?

about 4 years ago · Juan Pablo Isaza
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!