Something like this might help you
$('#date-selected').keydown(function (ev) {
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
if (keycode == '13') {
var dp = $('#date-picker').data('datepicker');
// 1: we manually restore the input date so it's not toggled on/off
dp.dates.pop(); // idempotent if no dates
dp.dates.push(dp.viewDate);
dp.setValue();
// 2: we move to the next input field & close the picker
$('input[id!="date-selected"]').first().focus();
dp.hide();
}
});
此链接可以帮助您解决以下问题:在按Enter后手动输入日期
以下代码为我工作,发布我自己问题的答案以帮助其他人
$(".datepicker").datepicker('hide');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.