Last Updated

Show viewers when a page was last updated, and automatically update it - like so:

First, place this code on your webpage wherever you want the date and time to appear:

Then, under the closing html tag right at the bottom of your page, paste in this script:

If you want to put this on several pages of your site, you can also just create one javascript file called last-updated.js containing the code:

then on any pages you want to display the date, include the #lastmodbox div as before, and under the closing html tag at the end, a link to the script:

Adaptations

Do you want to learn javascript? See if you can work out how to...

  • The current code puts the words Last Updated before writing out the date. Change or remove this
  • Change the div for a span, a h4, a p or any other kind of element - so long as the ID remains the same, the code will still work
  • Change what the date looks like in the CSS, using #lastmodbox {YOUR CODE HERE}