I have two different daterangepicker in the same form, because I need to have it in two inputs nor only in one.. So I initialize this with a class selector: $('.daterange').daterangepicker({});
everithing works perfect, but I want to do change two both. If I select a range in the first one, when I open the second one I want to have the same range selected in the calendars. So I'm trying to do it in ON SHOW event
$('.daterange').daterangepicker()
.on('apply.daterangepicker' ,function(ev, picker) {
$('.scheduledStartGmt').val(picker.startDate.format(picker.format)).change();
$('.scheduledEndGmt').val(picker.endDate.format(picker.format)).change();
})
.on('show.daterangepicker' ,function(ev, picker){
$('.daterange').data('daterangepicker').setStartDate($('.scheduledStartGmt').val());
$('.daterange').data('daterangepicker').setEndDate($('.scheduledEndGmt').val());
});
Only changes the first one. How can I do it?