I’m making an AJAX request with $.get command. When that completes I append the HTML code to my existing div. After all my code got appended I noticed that I can’t access my newly added code with jQuery selector. I’ve read other DOM refreshing question but those are related to ‘click’ events. I just wanted to access my added id with $(“#xxxxxxxx”)
For example, I added
<div id="aaa1"></div><div id="aaa2"></div><div id="aaa3"></div>
into my existing
<div id="container"></div>
What I wanted to add is in temp.html file, so I used $("#container").load("temp.html"); Things got added nicely but I can’t access it. ( Using alert($("#aaa1").html()) returnd undefined )
Try this :