So I have this program that whenever the expiration date
is exactly the same date as today
the background of the <div>
will change it color. But right now, the background color change only when my condition is ==
and when I try to use>=
or <=
the background color does not change. Also the background color change even the expiration date
is not the same as the date today
Here is my javascript:
<script type="text/javascript">
var $today = date("m/d/Y");
var $expired = $passport_expiration;
function myDIV() {
if ($today == $expired) {
document.getElementById("myDiv").style.backgroundColor="#ff4d4d";
}
}
</script>
Here's my HTML:
<div class="col-md-6" id="myDiv">
<div class="alert" role="alert"><span class="glyphicon glyphicon-book" aria-hidden="true"></span> Passport <?php echo "<strong><a href=\"view_latest_passport.php?id=$id\"> $passport</a> / Passport Expiration Date:</strong> $passport_expiration"; ?></div>
</div>
How I get the $today
and passport_expiration
, it is in my query
Thank you in advance