title: How to make a two date picker depend on each other in html?
body: <p>Suppose there are two date pickers. The second date picker will be fully depended on the first one as given in the snippet </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$( function() {
    $("#txtFromDate").datepicker({
           numberOfMonths: 2,
           minDate:0,
           onSelect: function(selected) {
             $("#txtToDate").datepicker("option","minDate", selected)
           }
       });
       $("#txtToDate").datepicker({ 
           numberOfMonths: 2,
           onSelect: function(selected) {
              $("#txtFromDate").datepicker("option","maxDate", selected)
           }
       });  
      
   });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://code.jquery.com/jquery-1.12.4.js"&gt;&lt;/script&gt;
   &lt;script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  From: &lt;input type="text" id="txtFromDate" /&gt;
             To: &lt;input type="text" id="txtToDate" /&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>If we select a date from the first date picker is there any method if we leave empty the second date picker then the date of second date picker will set to the same date as the first but after the one year. It means if  we set the date in first is <code>07-29-2018</code> then if we left empty the second date picker then the date will automatically taken as <code>07-29-2019</code>. Is there any method for doing this. can any body please help me. Thank you.</p>