I\'m using Dan Grossman\'s daterangepicker.
http://www.dangrossman.info/2012/08/20/a-date-range-picker-for-twitter-bootstrap/
Which is initialised in my we
this section is the callback function:
function(start, end) {
$('#dateRange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
}
you can add any code you want in this function to execute when a user selects a date. you could even define a callback function yourself and pass it to the daterange picker method.
example:
function myCallback(start, end) {
$('#dateRange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
alert('hello world'); //etc, your code here
}
// attach daterangepicker plugin
$('#dateRange').daterangepicker(options, myCallback);
you also could even define your own custom event handler and trigger it in the callback as well.
example
$(document).on('myCustomEvent', function () {
// your code here
});
$('#dateRange').daterangepicker({
// .. //
function(start, end) {
$('#dateRange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
$(document).trigger('myCustomEvent');
});
From daterangepicker.com:
$('#daterange').on('apply.daterangepicker', function(ev, picker) {
alert ('hello');
});