I am trying to replace the year 2011 in a footer that contains the copyright with the current year.
Currently I have successfully replaced ‘2003-2011’ with ‘2003-2012’ like this:
$(document).ready (function (function(){
$('div.footer').html($('div.footer').html() .replace('2003-2011','2003-2012'));
});
But I wanted to replace ‘2011’ with the current year so you don’t have to change the script every year.
Doing this doesn’t work:
var year=getFullYear();
$(document).ready (function(){
$('div.footer').html($('div.footer').html() .replace('2011','year'));
});
As always, thank you very much for your help.
Don’t put
yearin quotes, it’s a variable. Putting it quotes makes the string'year'.