Keith Wood DatePicker - DateRange - Event on the second date click

Keith Wood DatePicker - DateRange - Event on the second date click

Hi everybody !

I recently discover this datepicker, and I have a question.

I would like to do an event when i select the second date in a daterange datepicker...

I tried this :

$('#rangeInlinePicker').datepick({
        minDate: $.datepick.today(),
        onSelect: function(dates) {
            if(dates[1]!=dates[0] && dates[1]!=''){
                (The event i would like to do, alert lol is just for a test ) alert('lol');
            }
         }, rangeSelect: true, monthsToShow: [1, 3]
    });

It works BUT the alert('lol'); is executed 2 times at load when I have already dates in my cookie...