Skip to content

Instantly share code, notes, and snippets.

@curtiswilkinson
Created August 22, 2015 07:51
Show Gist options
  • Save curtiswilkinson/6d1affc22422a7b19f2d to your computer and use it in GitHub Desktop.
Save curtiswilkinson/6d1affc22422a7b19f2d to your computer and use it in GitHub Desktop.
Hiding DOM element base on day of the week/hour of day
$(document).ready(function () {
var d = new Date();
var dayOfWeek = d.getDay()
var hour = d.getHours();
if (dayOfWeek === 1 || dayOfWeek === 2 || dayOfWeek === 3) {
$('.element').show();
}
if (dayOfWeek === 4 && hour < 13) {
$('.element').show();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment