Kristaps,

Try something like,

$(document).ready(function(){
   var year = newDate().getFullYear();
   $(".y").empty().append(year);
});

Cheers,
Chris

Kristaps Ancāns wrote:
Ok i'm a newbie in jquery and i'm trying to write function that will replace all <span class="y"><!-- --></span> element's content with current year. My function looks like this: $(function(){
 $(".y").ready(function() {
  var today = new Date();
  var year = today.getFullYear();
  document.write(year);
 });
});
but when i run it - it replaces all the document with current year. In which place my mistake is ?
--
FYFI - for your fucking information
------------------------------------------------------------------------

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to