I'm trying to load the contents of a HTML file into a div using JavaScript/jQuery by doing this on page load:
$("#div_name").load("xxx.html");
It displays everything fine, but then if I then try to select any of the DOM elements loaded by this file e.g. with document.getElementById(#some_other_div)
, they are not found.
I could read in the file as text using AJAX, then use $("#div").append
, but it seems pretty long-winded - is there a straight-forward way of making these external elements accessible by the current document or am I going to have to AJAX it?