title: jquery datepicker get date (part 2)
body: <p>Cont on <a href="https://stackoverflow.com/questions/34129220/jquery-datepicker-set-end-date-value-blank/34131726#34131726">jquery datepicker set end date value blank</a> </p>
  
  <p>My code:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;   
  &lt;link rel="stylesheet" href="js/jquery-ui-themes-1.11.1/themes/smoothness/jquery-ui.css"&gt;
  &lt;script type="text/javascript" src="js/jquery-1.11.1.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="js/jquery-ui-1.11.1/jquery-ui.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  $(document).ready(function(){
      $("#datepicker1").datepicker({
          dateFormat: 'dd-mm-yy',
          onSelect: function(selected){
              $("#datepicker2").datepicker("option", "minDate", selected);
          }
      });
  
      $("#datepicker2").datepicker({
          dateFormat: 'dd-mm-yy'
      });
  
      $("#datepicker1").focusout(function(){
          $('#datepicker2').val('');
      });
  
      $('#reset').click(function(){
          $('#datepicker2').datepicker("option", "minDate", null);
      });
  });
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;form method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;"&gt;
  &lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt;Start Date : &lt;/td&gt;
          &lt;td&gt;&lt;input type="text" name="startdate" id="datepicker1" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;End Date : &lt;/td&gt;
          &lt;td&gt;&lt;input type="text" name="enddate" id="datepicker2" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;
              &lt;input type="submit" id="submit" name="submit" value="Add" /&gt;
              &lt;input type="reset" id="reset" name="reset" value="Reset" /&gt; 
          &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>I want to get the start date and end date value from text field. After that I want to perform the following:<br />
  - start date value is blank => show "You must select start date" message<br />
  - end date value is blank => show "You must select end date" message<br /></p>
  
  <p>This is the logic that I tried:<br /></p>
  
  <pre><code>var startdate = $('#datepicker1').val(); //start date text field
  var enddate = $('#datepicket2').val(); //end date text field
  
  if(startdate == '')
      alert("You must select start date");
  
  if(enddate == '')
      alert("You must select end date");
  </code></pre>
  
  <p>But I didn't know where should I put them in my code. Can someone help me?</p>