At the start of every year, you have to remember to open the editor, scroll down to the bottom, and change the year of your website. However, in this lesson, you will learn how to add a little bit of code to completely automate this process for you. You will be able to automatically update the year in your copyright notice at the bottom of your website!
$w.onReady(function(){
const today=new Date();
const year=today.getFullYear();
$w('#copyrightText').text= `© ${year} Wix Fix | All Rights Reserved`;});
Remember for the code to work, you must change the name of the "copyrightText" text element to match the code, or visa versa. Also, remember to paste the code into the "masterPage.js" file. Don't just paste the code to your homepage design if you have multiple pages.
Have Fun!
תגובות