Recent Posts

Caution: Greetings to all visitors. The site is working in short. Links Please skip the link to view any topic and thank you for visiting
header ads

Auto footer copyright year with Javascript

I have seen this done with PHP before and have done it myself with PHP. But I realized why not use JavaScript. It's very simple.

(function (){
var date=new Date();
if(document.querySelector("#auto-year-update")!==null){
document.querySelector("#auto-year-update").innerText=date.getFullYear();
}
})();
Code (JavaScript):
With this code we would just need to replace the year 2019 with a <span id="auto-year-update"></span> which will then be populated with the current year.

from JavaScript https://ift.tt/2Jg258P
via IFTTT

Post a Comment

0 Comments