Blog
Webflow Tip

Always Display Current Copyright Date in the Footer Using Javascript in Webflow

Jaroslav Dlask
Jaroslav Dlask
February 16, 2023
2 min
Always Display Current Copyright Date in the Footer Using Javascript in Webflow

1) Add a Text Block to the Footer

Locate your website's footer and add a text block there. Make sure you are using the footer as a component so that it automatically updates on all other pages.

text block at the footer
Text block in the footer

2) Add a Text Span to Text Block's Year

Select the "2000" and create a text span. You don't need to give it any class.

Text Span
Text Span

3) Give a Unique ID to the Text Span

Move to the settings panel in Webflow and give a unique ID to the text span. In this case, I choose "copyright-year". Please mind that the ID has to be unique in your entire Webflow project.

Text Span ID

4) Add This Piece of Code Right After the Text Block

Last but not least don't forget to add the code below into the embed right after the text span. Don't forget to place the code between <script></script> tags. This way the copyright year will be always up to date!

<script>
 document.getElementById("copyright-year").innerHTML = new Date().getFullYear();
</script>
Embed
Embedded script