Speed up development with full-stack environments for every branch.

Learn More

jquery datepicker set end date based on start date [JavaScript]

Forked from How to use the jQuery $().ready function.

2932 Runs 10696 Views 6015 Copies

some HTML5 magic



a3csdev 2

published 2 years ago

    /*  jQuery ready function. Specify a function to execute when the DOM is fully loaded.  */
      //var dropoffdate;
      /* This is the function that will get executed after the DOM is fully loaded */
      function () {
        $( "#pickup_date" ).datepicker({
          //changeMonth: true,//this option for allowing user to select month
          //changeYear: true //this option for allowing user to select from year range
          minDate: new Date(),
          onSelect : function(selected_date){
            var selectedDate = new Date(selected_date);
            var msecsInADay = 86400000;
            var endDate = new Date(selectedDate.getTime() + msecsInADay);
             $("#dropoff_date").datepicker( "option", "minDate", endDate );
    Please login/signup to get access to the terminal.

    Your session has timed out.

    Dismiss (the page may not function properly).