At the top of my script I have created a variable out of todays date:
<?php $today = date('dmy'); ?>
I then have a table and each table row has a class either of "nodate" or of a six digit number, this number represents a date. eg 230910 (yesterday).
I am trying to write some jquery that hides the table row if the class (six digits) is less than todays date ($today) as a number. eg if 230910 < 240910
<script type="text/javascript">
var todaysdate = "<?php echo $today;?>";
$(document).ready(function() {
$("#main table tr").each(function() {
if ($(this).hasClass('nodate')) {
$(this).css("background", "blue");
} else {
var expire = (parseInt($(this).attr('class')));
alert (expire);
if (expire < todaysdate) {
$(this).css("background", "red");
}
}
});
});
</script>
For testing I have it so if the table row has a class of "nodate" then the background changes blue. Then if table rows date (six digit number) is less than todays date then go red.
Currently all the rows with the six digits are turning red and for some reason, if the digits start with a zero then the class outputs differently.
eg
<tr class="<?php $date = "041010"; echo $date; ?>">
Outputs as 16904 :S
can anyone help?