Reputation: 225
<body>
<div class="container">
<div class="content_1"></div>
<div class="content_2></div>
</div>
</body>
extracontent.html
<div class="content_3">
<ul>
</ul>
</div>
how to i append my html page to body container without removing content inside ?i tried to use load but it remove all my element inside.
my code
// $('.container').load('extracontent.html',
// function(){alert('Content Successfully Loaded.')}
// );
i tried to use append also but it wont as well.
// $('.container').append('extracontent.html');
Upvotes: 2
Views: 46
Reputation: 164897
Use jQuery.get()
and .append()
$.get('extracontent.html', function(html) {
$('.container').append(html);
});
Upvotes: 4