title: jQuery datePicker setDate function blanks the input field when input field is inside a <form> element
body: <p>Fanrod here. It's my first time so be gentle with me.</p>
  
  <p>See the code below. It should just work, yes? When you click the button the input field should display today's date but today's date just flashes up for a second then the box goes blank. </p>
  
  <p>If you remove the FORM tags then it works as expected.</p>
  
  <p>So setDate() doesn't work if the input field is inside a FORM element.</p>
  
  <p>Have tried this under Firefox and Chrome and get the same result.</p>
  
  <p>Am I abusing datePicker?</p>
  
  <p>Have scoured stackoverflow, experts exchange, etc. for a resolution but no joy.</p>
  
  <p>I can't believe this is a bug because datePicker is so widely used but I can't see any other conclusion. </p>
  
  <p>The only work-arounds I can see are to either never have the input field inside a FORM (feasible in my case but worrying for the future) or to use $("#ttdateofbirth').val(...) with obvious drawbacks.</p>
  
  <p>Does anyone know how to fix this?</p>
  
  <p>Thank you for your input.</p>
  
  <p>Non-working web-page:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
  &lt;head&gt;
  &lt;title&gt;DatePicker test&lt;/title&gt;
  &lt;link rel="stylesheet" href="js/css/ui-lightness/jquery-ui-1.10.0.custom.css"/&gt;
  &lt;script type="text/javascript" src="js/js/jquery-1.9.0.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="js/js/jquery-ui-1.10.0.custom.js"&gt;&lt;/script&gt;
  
  &lt;style type="text/css"&gt;
  .datepicker {
      font: 11pt "Trebuchet MS", sans-serif;
      margin: 10px;
  }
  .inputlabel {
      font: 11pt "Trebuchet MS", sans-serif;
      margin: 3px;
      float:left; clear:left;
      display: block;
  }
  
  .ui-datepicker { font-size: 8pt !important; background: #cccccc; }
  
  input {
      float: left;
      margin-bottom: .25em;
      font: 11pt "Trebuchet MS", sans-serif;
      margin: 3px;
      }
  button {
      float: left;
      margin-bottom: .25em;
      font: 11pt "Trebuchet MS", sans-serif;
      margin: 3px;
      }
  
  &lt;/style&gt;
  &lt;script type="text/javascript"&gt;
  //&lt;![CDATA[
  // set up inputs for dates before today's date
  $(function(){
      var pickerOpts = {
          showOtherMonths: true,
          selectOtherMonths: true,
          dateFormat: "dd/mm/y",
          showButtonPanel: true,
          changeYear: true,
          changeMonth : true
          };
          $("#ttdateofbirth").datepicker(pickerOpts);
          });
  
      function setthedate() {
          var adate = new Date();
          $("#ttdateofbirth").datepicker('setDate',adate);
          };
  //]]&gt;
  &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form&gt;
  &lt;span class="inputlabel"&gt;Date of birth:&lt;/span&gt;
  &lt;span&gt;&lt;input id="ttdateofbirth" type="text"  value=""/&gt;
  &lt;button style="float:left;display:inline;" onclick="setthedate()"&gt;Set date&lt;/button&gt;
  &lt;/span&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>