$("#datepicker").datepicker(
{
// The CallBack argument is an anonymous function
onSelect: function(dateText, inst)
{
// This invokes the real function
myCallBackFunction(dateText, inst);
}
}
);
// This is the real function that will
// be executed when the onSelect
// invokes its Callback
function myCallBackFunction(dateText,inst)
{
$("#selectedDate").val(dateText);
}
With a simple callback function the anonymous function can contain the processing.
$("#datepicker").datepicker(
{
// The CallBack argument is an anonymous function
onSelect: function(dateText, inst)
{
$("#selectedDate").val(dateText);
}
}
);