INCLUDE COMMON FILES IN HTML USING JQUERY

3840 ワード

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.
 1 <html>

 2 <head>

 3 <title>Include Common Files</title>

 4 <script src=”//code.jquery.com/jquery-min.js”></script>

 5 </head>

 6 <body>

 7 <div id=”header”></div><br />

 8 <div id=”content”>

 9 Main Content

10 </div><br />

11 <div id=”footer”></div>

12 <script>

13 $(“#header”).load(“header.html”);

14 $(“#footer”).load(“footer.html”);

15 </script>

16 </body>

17 </html>