[jQuery] Else If statements - why isn't this working?
This'll probably seem obvious to anyone with more jQuery knowledge
than myself...
I'm using the below code to show/hide specific divs according to which
day it is. However, for some reason it isn't working. I've tried my
best to find doumentation on how to write If/Else statements for
jQuery but it's pretty thin on the ground... I've probably just missed
something out. But, any ideas why none of the actions take place?
$('body.schedule').ready(
function(){
var today = new Date().getDay();
if (today == "2") {
$("div.monday").hide();
} else if (today == "3") {
$("div.monday").hide().next().hide();
} else if (today == "4") {
$("div.monday").hide().next().hide().next().hide();
} else if (today == "5") {
$("div.monday").hide().next().hide().next().hide().next().hide();
} else if (today == "6") {
$
("div.monday").hide().next().hide().next().hide().next().hide().next().hide();
} else if (today == "7") {
$
("div.monday").hide().next().hide().next().hide().next().hide().next().hide().next().hide();
}
}
);
Thanks in advance,
Zarino Zappia