javascript date and loop check
- by StealthRT
Hey all, this is the code i have to check for a day thats equal to the list of days in the comma seperated list:
for(var i = 0; i < daysHidden.length; i++){
if (daysHidden[i] == d.getDate());
{
alert(daysHidden[i] + '=' + d.getDate());
}
}
the daysHidden = 1 (its the only thing in the list April 1st is already gone and todays the 2nd so 1 is the only one in the list)
and d.getDate() has 1-30 (for april)
When i run the code, however, it keeps looping through the if code when it should only loop once (when it finds that 1=1
However, i keep getting the alert box that says:
1=1
1=2
1=3
etc.... 1=30
So i do not know what i am doing incorrect? I already tried putting them as strings:
if (daysHidden[i].ToString == d.getDate().ToString);
But that doesnt seem to work.... Any help would be great :)
David