Include another HTML file in a HTML file
HTML
<div class="container">
<div class="include" data-include="header" id="header">
</div>
</div>
<div class="container">
<div class="include" data-include="home" id="content">
</div>
</div>
<div class="container">
<div class="include" data-include="footer">
</div>
</div>
Add J query library file
Java Script
<script>
$(function () {
var includes = $('.include');
jQuery.each(includes, function () {
var file = 'views/' + $(this).data('include') + '.html';
$(this).load(file);
});
});
OR
<div id="header">
</div>
$(function () {
$("#header").load("views/header.html");
});
</script></div>
Comments
Post a Comment