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? 🙏