Auto Update The Copyright Year In Your Website – updateYourYearPLZ

Category: Javascript | January 18, 2019
Authorjusleg
Last UpdateJanuary 18, 2019
LicenseMIT
Tags
Views441 views
Auto Update The Copyright Year In Your Website – updateYourYearPLZ

The simplest way to automatically update the copyright year in your website’s footer section using the Date.prototype.getFullYear() API.

How to use it:

Wrap the copyright year in an element.

<span id="updateYourYearPLZ"></span>

The main JavaScript to auto update the copyright year.

document.addEventListener('DOMContentLoaded', function () {
  document.getElementById("updateYourYearPLZ").innerHTML = new Date().getFullYear();
});

 

You Might Be Interested In:


Leave a Reply