I am developing dynamic adding date range picker.
We adding every time new input type for selecting date range picker
Can we validate that previously selected date does not select for next date range picker?
You can do by using your daterangepicker's changeDate
or input change
event like,
// example by using on change event
$('input.datepicker').on('change',function(){
var inputs=$('input.datepicker').not(this), // get all input which are datepickers
current_value=this.value, // get date from active input
flagDate=false; // let the date is not taken previously
inputs.each(function(){
if(current_value==this.value){
flagDate = true; // date is taken in previous fields
return false;// break the loop
}
if(flagDate){
alert('This date is already taken, please choose another one.');
}
});
});