Sunday, December 28, 2008

[jQuery] applying css style to past dates

Hi,

I'm trying to make text red when a date in an input field occurs in
the past. However, it isn't working when I try it out.. I'm new to
JQuery, so i'm not sure what i'm doing wrong..

$(document).ready(function(){
$(".date:text").each(function (i) {
if(parse(this.value) < Date.getTime()) {
this.style.color = "red";
}
});
});

This is one of the input fields that I want it to turn red.

<input class="date" type="text" value="11/17/2008" name="expires_256"/
>

Any ideas? I'd love the help. :)

Thanks in advance,

Matt

No comments: