Hi Zarino, You won't find any documentation about jQuery's if/else statements for the same reason that you won't find any documentation on jQuery's assignment statement, arithmetic operators, or Date object. All those things are part of the JavaScript language itself, not part of jQuery. So of course you can use them all in jQuery code, but a search like this won't give you much useful information:
http://www.google.com/search?q=jquery+if+else+statement In fact, your post from two hours ago is currently the fourth item in the results for that query. You're famous! :-) However, this search will give a wealth of information: http://www.google.com/search?q=javascript+if+else+statement OTOH, if/else statements are definitely not the best way to do what you're trying to do here. Any time you find yourself writing code that is this repetitious, that's a hint that there is probably a simpler way to do it. In fact, it's likely that you can do this in just a line or two of code. But I can't really suggest another approach yet, because I don't know for certain what it is you want to do. Can you post the related HTML code along with a description of exactly what you want to have happen? I do have one tip: The range of the getDay() function is 0 through 6, where 0 represents Sunday and 6 represents Saturday. So "today == 7" will never happen, and "today == 2" would be Tuesday, not Monday, etc. Anyway, post that HTML code and description and someone will be able to suggest a good way to do it. -Mike > From: zarino > > 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 >