Table which has a "date-inputfield"(normal input type="date" ta) and "Add button"(which creates new date-field)
I'm using code from this website:
I've just added an datefield Link to the code
I found this solution but it lacks add button and how to increment the date over and over again.
Problem I'm facing: user has to fill date everytime he clicks Add button
Where I need help: I want user to fill the first date-field and when he clicks Add the date gets incremented by one and again he clicks Add the previous date gets incremented
for eg:
- user enters 01/01/2018
 - clicks add (new date-field generates)
 - the date field is set to 02/01/2018
 - clicks add again (new date-field generates)
 - the date field is set to 03/01/2018
 
as long as he clicks add button date keeps incrementing
I have tried on(),prev(),closest() jquery method to target the previous date but nothing seems to work I even tried stepUp() method of javascript but i get tangled on how to target the previous date. I also thought of using moment.js,date.js but i don't know how to increment the date in dynamically created date field
I've stuck in this problem for over a week. any suggestion on how I can improve my web development skill thanks:D
<div id='holder'> </div>
$("#holder").append('<input id="date1" />');
$("#holder").append('<input id="date2" />');
$('#date1').datepicker();
$('#date2').datepicker();
$('#date1').change(function(){
    var date1 = $('#date1').datepicker('getDate');
    var date = new Date( Date.parse( date1 ) ); 
    date.setDate( date.getDate() + 1 );
    var newDate = date.toDateString(); 
    newDate = new Date( Date.parse( newDate ) );
    $('#date2').datepicker('setDate', newDate );
})