问题
I am trying to set focus on input of datepicker, after datepicker closes, but without opening it again.
Does anyone have a solution to this wicked request?
I have tried something like this, but finally I cant get it to work for IE9.
$.datepicker.setDefaults({
onClose: function(dateText, inst) {
showDatepicker = false;
if (detectIE()) {
$(this).focus();
} else {
setTimeout(function() {
$(this).focus();
})
}
},
beforeShow: function() {
if (!showDatepicker) {
showDatepicker = true;
return false;
}
}
});
来源:https://stackoverflow.com/questions/33239135/set-focus-on-jquery-datepicker-on-datepicker-close-without-opening-datepicker