I'm trying to reset the value of the input once i click a date in the datepicker, my goal is to add a single date in the array once a click a date, what happening is once i click a date for the multiple times, it still holds the previous value of the input.
var date = new Date();
var days = [];
$(document).ready(function(){
$("#inputMultiDate").datepicker({
autoclose: true,
todayHighlight: true,
multidate: true,
format: 'dd-mm-yyyy'
}).on("changeDate", function(){
dates = $('#inputMultiDate').val().split(',');
days.push(dates);
$('#inputMultiDate').attr('value', '');
console.log(days);
});;
});
<input type="text" id="inputMultiDate" class="form-control" placeholder="Pick the multiple dates">