One of the rules that a programmer must follow is to always avoid repetition as much as possible to simplify the coding process, you can either make it a variable or make it a file and link it across various files.
This tutorial will be covering how to make it a file and link it across various Documents.
1. Save the particular part of the page that you wont like to repeat in a text document e.g repeat.html
2. On the page where you want it to appear, create a <div id="repeat"></div> tag exactly where you wanted it to appear with an ID which you can give any value of your choice.
3. Inside the div use the following javascript codes
<script type="text/javascript">
$("#repeat").load('repeat.html');
</script>
Then you have successfully implented this tutorial.
For updates follow us on Facebook
Comments
Post a Comment