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