The Any Time date picker doesn't close when the user clicks a date with the mouse, only when they hit enter. How can I make it so it closes with a mouse click? I found this code in anytime.js:
if ( this.oDiv && this.oDiv.is(':visible') )
this.dismissODiv(event);
else if ( this.yDiv && this.yDiv.is(':visible') )
this.dismissYDiv(event);
else if ( this.pop )
this.dismiss(event);
This I believe is the code that executes when the user hits enter. I think I just need to paste this code in the mouse click function, but I can't find it.
I found the function (I haven't tested yet, however), and it's between line 1579
~1592
.
To find the handler, I first searched jQuery(a JS library which AnyTime date picker is using)'s .click
function, which is frequently used for handling click events.
One I found was in the btn()
function, which comment says that this function is for making buttons. Since it is written that .btn() is called by AnyTime.picker() ... The "handler" is bound to click events for the <div> ...
, next thing I did is to find a code in Anytime.picker()
function which makes buttons of days.
Then I searched for Anytime.picker = function(
to find the definition of Anytime.picker()
function, and I found that askDoM
variable (in line 1452
) is used to determine whether the day of month is 'asked'.
From that, I easily found the code making buttons of days which starts from line 1557
, and then I found the code calling btn
function with the handler.