title: jQuery date script won't populate field unless it is text input type
body: <p>I have a script that populates one of the fields in my form to today's date, however it only works when the input type is set to 'text'. PHP/SQL won't accept this value as the SQL datatype is set to 'date'. If anyone could explain how I might make this script compatible with the date input type I would greatly appreciate it.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;label class="control-label" for="flight_date"&gt;Date&lt;/label&gt;
      &lt;div class="input-group"&gt;
          &lt;div class="input-group-addon"&gt;
              &lt;i class="fa fa-calendar"&gt;&lt;/i&gt;
          &lt;/div&gt;
          &lt;input id="flight_date" type="date" class="form-control" maxlength="10" name="flight_date"&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code>var date = new Date();
  
  var day = date.getDate();
  var month = date.getMonth() + 1;
  var year = date.getFullYear();
  
  if (month &lt; 10) month = "0" + month;
  if (day &lt; 10) day = "0" + day;
  
  var today = day + "/" + month + "/" + year;
  
  document.getElementById('flight_date').value = today;
  </code></pre>
  
  <p><a href="https://jsfiddle.net/sinesine/ygL4gjbd/1/" rel="nofollow noreferrer">JSFiddle</a></p>