Thursday, January 2, 2014

How to add common pages in html using Jquery

How to add common pages in html using Jquery?


Simple example for including common files in HTML. JQuery load() function is used for including common HTML files in multiple pages. An example for this is added here,

<html>
<head>
<title>Include Common Files in HTML</title>
<script src=“http://code.jquery.com/jquery-1.10.2.js”></script>
</head>
<body>
<div id=“header”></div><br />
<div id=“content”>
Main Content
</div><br />
<div id=“footer”></div>
<script>
$(“#header”).load(“header.html”);
$(“#footer”).load(“footer.html”);
</script>
</body>
</html>


No comments:

Post a Comment