I have this initialization code:
$(document).ready(init);
function init() {
var currentDate = new Date();
currentDate.setHours(currentDate.getHours() + 1);
var dat = (currentDate.getDate()+"/"+(currentDate.getMonth()+1)+"/"+currentDate.getYear());
$('input[name=category]').click(loadList);
$('#datepicker').datepicker({
inline: true,
showOtherMonths: true,
dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
dateFormat: 'dd/mm/yy',
});
var currentDate = new Date();
currentDate.setHours(currentDate.getHours() + 1);
$("#datepicker").datepicker("setDate", currentDate);
$("#datepicker").datepicker({
onClose: function() {
alert("wow");
loadList;
}
});
loadList();
}
The category part (line 5) is working perfectly and on each click it responds successfully.
I want to get the same reaction, but instead of “click” such as in name=category, when datepicker is close.
I want it to raise an alert with “wow” and to call the javascript function “loadList” (such as line 5 does).
Just pass a function as
onClosein the options object used when constructing the datepicker: