Middle-Level Middle-Level - 1 year ago 47
HTML Question

Display "End Date" based on datepicker "Start Date" and inputted date

Need answer as soon as possible!

How to get a end date based on a inputted day interval and start date like if i have a start date that has a value of

and the then the inputted day interval is like
how would I do that in jquery and the event will trigger if the value inside the datepicker input box changed.

Guys I will appreciate all your help T_T.


you may refer to the answer How to add number of days to today's date?

Assuming, you are using jqueryui datepicker. if so, use following code to get the selected date, as soon as the date is selected from the datepicker.

  $(function() {
    $( "#from" ).datepicker({
      onSelect: function( selectedDate ) {
        var startDate = selectedDate; // you got the startDate here