Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

136
Vistas
How can an external JavaScript access html elements output by xmlhttprequest?

Xmlhttprequest I'm returning a html div element from a php file to another php file using xmlhttprequest ajax

I'm outputting the div xhr.responseText with innerhtml. Example

document.querySelector('div.users').innerHtml = xhr.responseText;

Which is working fine.

The problem is that the response gotten is not accessible by an external JavaScript

Example. The response is like this. <div class="me">hello world</div>

When I use an external JavaScript to get the the elements. Nothing works. Example

document.querySelector('.me').addEventListener("click", () =>{console.log("hi");});

Nothing happens when the element is clicked.

Any solution please? 🙏

about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda