Reputation: 131
I have created dynamic div element as shown below
var newDiv1 = $(document.createElement('div'));
newDiv1.attr('id','nedi');
newDiv1.attr('style','position:absolute;top:10;right:15;');
I am trying to load html content with the following line of code but ended up in vain!
$('#newDiv1').load('new_one_2.html');
my folder structure as shown in the image attached. Please help me to load html content with jquery load
Upvotes: 0
Views: 59
Reputation: 167172
You have given a different ID. Use:
$('#nedi').load('new_one_2.html');
Variable name is different from id
. Or you should use something like:
$.get("new_one_2.html", function (res) {
newDiv1.html(res);
});
Upvotes: 1