0

i have two date datepicker area and i want set the my finish date by my startDate + myText value like 3,5,2(day) but i get error in this line $("#finishDate").setDate(startDate + inputDate); give me

"Uncaught TypeError: $(...).setDate is not a function"

How can i do this. Thanks.

 $("#myText").on('change', function () {
                var startDate = $('#startDate').val();                
                var inputDay = $('#myText').val();
                $("#finishDate").setDate(startDate + inputDay);
 });
joe
  • 79
  • 9

1 Answers1

0

try using this

$(document).on('change', "#myText", function () {
     var startDate = $('#startDate').val();                
     var inputDay = $('#myText').val();
     $('#finishDate').val(startDate + inputDay).datepicker('setDate', new Date(startDate));
     //$('#finishDate').val(startDate + inputDay).datepicker('setDate', startDate); //based on your date format
 });
John Clinton
  • 204
  • 1
  • 6