I'm trying to change the color of the input text whenever the$visa_expired is the same date as today. But right now, I get an error saying Invalid Date
Here is my code:
  <script type="text/javascript">
function checkFilled() {
  var today = new Date();
  var expired = new Date("<?php echo $visa_expiry; ?> ");
  var inputVal = document.getElementById("expiry");
    if (inputVal.value == "") {
        inputVal.style.backgroundColor = "red";
        window.alert(today);
    }
    else{
        inputVal.style.backgroundColor = "yellow";
    }
}
checkFilled();
  </script>
Here is my HTML:
<input type="text" class="form-control" size="5" value="$visa_expiry" id="expiry">
 
     
     
     
     
    