$('.selector').datepicker({
onChangeMonthYear: function(year, month, inst) { ... }
});
Come posso utilizzare il parametro 'inst' di onChangeMonthYear per auto-selezionare il primo giorno del mese?jQuery UI datepicker onChangeMonthYear e il parametro inst
vedi: http://jsfiddle.net/sD8rL/
Attualmente sto usando il codice qui sotto, ma mi sento come dovrei essere in grado di utilizzare la variabile 'inst' in un modo più diretto.
$(".datepicker").datepicker({
changeMonth: true,
changeYear: true,
maxDate:0,
onChangeMonthYear: function(year, month, inst){
// set date to 1st on year or month change
// this seems bit janky, but works
$('#' + inst.id).datepicker("setDate", month + '/1/' + year);
// Can't I use the instatnce to set the date?
// $(inst).datepicker("setDate", month + '/1/' + year); // fails
// inst.datepicker("setDate", month + '/1/' + year); // fails
// inst.selectedDay = 1; // fails
// inst.currentDay = 1; // fails
}
});
Questo ha senso, in realtà non avevo alcun motivo particolare per usare "inst", "questo" funziona alla grande. – ActionOwl