I have this example
$('#datepicker').daterangepicker({
timePicker: true,
startDate: new Date(),
endDate: new Date(),
locale: {
format: 'MM/DD/YYYY HH:mm'
}
}, function(start, end, label) {
$("#range1").val(start.format('MM/DD/YYYY HH:mm:00')+" - "+end.format('MM/DD/YYYY HH:mm:00'));
});
How can I dynamically change the daterangepicker to a dynamic datepicker? I mean that when clicking on a button, disable the second calendar and work like a classic datepicker.
Try that when clicking on the button to deactivate, you remove the
daterangepicker
using$("elemento").data("daterangepicker").remove()
and then apply thedatepicker
to the input.Check out this example running in jsbin since I couldn't get it to import the library
daterangepicker
into the site editor.I post the code by rule.