Skip to content

JavaScript snippet for dynamically updating footer copyright year.

twitter logo github logo Updated on ・1 min read  

Hi, today am going to code a js snippet for dynamically updating the footer’s copyright year.

document.getElementById('copyrightYear').innerHTML = new Date().getFullYear();

Place the id (copyrightYear) in a span tag at the footer section after © symbol and before company name.

Place the above code in script tags at the bottom before closing body tag.

You will get the current year without any hassle to update it regularly every year.

If you like the post, share with your friends.


twitter logo DISCUSS (6)
markdown guide

Thank you, edited it. But actually as far I learned no one mentioned that document.write() is deprecated but I think it is a bad practice. Am still a novice in JS. Thank you for pointing it out.


Excellent.. Am hoping to learn Rails after mastering js and node.

Classic DEV Post from Jul 21 '19

What's hard about React Hooks for you?

React Hooks are amazing, but require a learning curve... What's it been like for you?

Vivekanand Padala profile image
A self-learned front-end web developer. I love JavaScript and everything that is open source.

Sore eyes? now has dark mode.

Go to the "misc" section of your settings and select night theme ❤️