Excuse me for a not-standart question, everything works fine, but it is still strange
On a webpage I use a datepicker from here
Here is the partial code:
HTML:
<div id="datepicker-calendar"></div>
Function for DatePicker insertion:
function insert_datepicker(mode)
{
$('#datepicker-calendar').empty();
...
$('#datepicker-calendar').DatePicker({
...
onChange : function(date,el) {
if (mode == 1){
doSmth1();
}
if (mode == 2){
doSmth2();
}
}
});
...
}
'mode' is not a global variable and is shown as 'undefined' in console.
When I call "insert_datepicker(2)" the onChange works fine, but shouldn't there be an error when the event is triggered?
How does the function "remembers" the note?