title: Validate date range with jquery datepicker
body: <p>Im trying to get the values from my datepicker into a new script which should validate that the second chosen value from datepicker is not before the first chosen datepicker.</p>
  
  <p>However, my script won't execute.</p>
  
  <p>This is my view:</p>
  
  <pre><code> &lt;div class="editor-field"&gt;
          @Html.TextBox("PlannedDate", Model.PlannedDate, new { @class = "date", @readonly = "readonly" })
          @Html.TextBox("CompletedDate", Model.CompletedDate, new { @class = "date", @readonly = "readonly" })
          @Html.ValidationMessageFor(model =&gt; model.CompanyName)
      &lt;/div&gt;
   &lt;input id="submitfloat" type="submit" value="Go" /&gt;
  </code></pre>
  
  <p>This is my Script</p>
  
  <pre><code>  &lt;script&gt;
    $(".date").datepicker();
    $('#submitfloat').submit(function() {
    var fromDate = $('#PlannedDate').val();
    var EndDate = $('#CompletedDate').val();
    if (Date.parse(fromDate) &gt; Date.parse(EndDate)) {
      alert("Date error")
      }
      return false;
  
  });
  </code></pre>
  
  <p></p>
  
  <p>However, when I start debug ut Firebug, it seems like my line <code>$('#submitfloat').submit(function() {</code> wont execute.</p>
  
  <p>Anyone know what my problem is and how it can be solved? Thanks in advance</p>