How to Link One html File across various pages with javascript

in #blog7 years ago

javahtml.png

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

    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

  $("#repeat").load('repeat.html');

Then you have successfully implented this tutorial.

Sort:  

Congratulations @mrwaccaff! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

Are you a DrugWars early adopter? Benvenuto in famiglia!
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Congratulations @mrwaccaff! You received a personal award!

Happy Steem Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

Downvote challenge - Add up to 3 funny badges to your board
Vote for @Steemitboard as a witness to get one more award and increased upvotes!