Reputation: 5670
I want to have some content on my page (some images) change based on the date. With jQuery, how would this be possible?
Basically, I am leaving on vacation and my client needs something to change while I'm unavailable.
I've been able to do it with ColdFusion for another client, but I don't know how to do it with jQuery. Any help is GREATLY appreciated.
Upvotes: 3
Views: 6925
Reputation: 27596
Example, check if Date is after Christmas. The div_id needs to be set to display:none; initially. You can change the selector to an id, class, or whatever else you need.
var now = new Date();
var Christmas = new Date("December 25, 2010");
if(now > Christmas) // today is after Christmas
{
// an id of a div that holds your images?
$('#div_id').show();
// or a class of images
$('.imageClass').show();
}
Upvotes: 6
Reputation: 10015
Have a look here for Date object: http://www.w3schools.com/jsref/jsref_obj_date.asp
based on date just change/manipulate images
Upvotes: 0