title: Setting TextBox.Text after Selecting a Date on an Ajax CalendarExtender
body: <p>On an ASP.NET page, I have a pair of <code>CalendarExtender</code> (AJAX Control Toolkit for ASP.NET 4.0) controls on a page acting as a date range. What I want to do is, after the user has selected the value for <code>TextCheckInDate</code> , populate <code>TextCheckOutDate</code> with <code>TextCheckInDate+ 1</code> if <code>TextCheckOutDate</code> is empty. </p>
  
  <p>Regrettably, my jQuery skills aren't yet where I'd like them to be. I know that I have to create a jQuery function that's fired when <code>TextCheckInDate</code> changes, I need to be able to read both textboxes, perform basic date arithmetic and write to the second textbox. The implementation eludes me. Thanks to <a href="https://stackoverflow.com/questions/2974496/jquery-javascript-convert-date-string-to-date">this post</a>, I know to use <a href="http://www.datejs.com/" rel="nofollow noreferrer">date.js</a> for my date arithmetic, included below...</p>
  
  <p>What I have so far:</p>
  
  <pre><code>$("input[id$='TextCheckInDate']").keyup
      (function (e) {
          checkCheckOutDate( $("#TextCheckInDate").val() );
      }
      );
  
  
  function checkCheckOutDate(checkInDate) {
      var startDate = Date.parse(checkInDate);
      if ($("#TextCheckOutDate").val() == "") {
          $("#TextCheckOutDate").val((1).days().after(startDate));
      }
  }
  </code></pre>