title: How do I stop the datepicker from displaying by default if no date is entered
body: <p>I am using jquery-ui-1.10.4.js and ASP MVC.
  In my View I am accepting an optional date as input;</p>
  
  <pre><code>@Html.EditorFor(model =&gt; model.Assessment.SsipAccreditationDate)
  </code></pre>
  
  <p>I have an Editor Template which injects the datepicker class;</p>
  
  <pre><code> @model DateTime?  
   @Html.TextBox("", (Model.HasValue ? Model.Value.ToLongDateString() : string.Empty), 
      new { @class = "datePicker", @style = "width:200px;" }) 
  </code></pre>
  
  <p>I have jquery code to hook up the datepicker with the date field;</p>
  
  <pre><code>if ($(".datePicker").length) {
      $(".datePicker").datepicker({ showOn: 'both', dateFormat: constantDateFormat, changeMonth: true, changeYear: true })
          .next('button.ui-datepicker-trigger')
          .attr("tabIndex", "-1");
  }
  </code></pre>
  
  <p>When the View is loaded, if this date field is empty the datepicker automatically displays. What I would prefer would be for the datepicker to only be displayed if the user clicks on it or the associated button. This is what the showOn: Both configuration is meant to acheive.
  Notice in the jquery the tab index is set to -1, so the reason for the datepicker showing cannot be to do with the field in focus.
  So how do I stop the datepicker showing when the View is loaded?</p>