Наконец я обошёл этот раствор.
function remove(tr_id){
$("#tr_"+tr_id).remove();
counter = $("#counter").val();
counter = parseInt( counter ) - 1 ;
$("#counter").val(counter);
}
function AddNewElement(){
counter = $("#counter").val();
counter = parseInt( counter ) + 1 ;
// YOUR SPECIFIC DYNAMIC HTML
var elestr = '<tr id="tr_'+counter+'" class="ele_tr"><td><input onclick="remove('+counter+');" id="remove" type="button" value="Remove"></td></tr>';
$("#ele_list").append(elestr);
$("#counter").val(counter);
}
$('body').on('focus',".dp_start", function(){
counter = $(this).data('counter');
counter = parseInt(counter);
var trialDate = new Date ($("#enddate_"+ (counter-1)).val());
trialDate.setDate ( trialDate.getDate () + 1 );
$(this).datepicker({
// changeMonth: true, changeYear: true,
dateFormat: "yy-mm-dd",
minDate: trialDate,
onClose: function (selectedDate) {
$("#enddate_"+counter).datepicker("option", "minDate", selectedDate);
}
});
});
$('body').on('focus',".dp_end", function(){
counter = $(this).data('counter');
counter = parseInt(counter);
$(this).datepicker({
// changeMonth: true, changeYear: true,
dateFormat: "yy-mm-dd",
minDate: $("#startdate_"+ (counter)).val(),
onClose: function (selectedDate) {
$("#startdate_"+counter).datepicker("option", "maxDate", selectedDate);
}
});
});