无论如何,在 jQuery datepicker 中选择日期后,我可以继续专注于输入元素吗?还有无论如何我可以阻止用户输入任何内容,但启用 tab 键?我目前正在使用阻止默认方法,但我只需要启用 tab 键。谢谢你。这是我目前的方法。
$('body').on('focus',".dateSem",function() {
$(this)
.datepicker({
changeMonth: true,
changeYear: true,
changeDay: true,
showButtonPanel: true,
dateFormat: 'yy/MM/dd',
showMonthAfterYear: true,
monthNames: ["01", "02", "03", "04",
"05", "06", "07", "08", "09", "10",
"11", "12"
],
monthNamesShort: ["1", "2", "3", "4",
"5", "6", "7", "8", "9", "10",
"11", "12"
],
dayNamesMin: ["日", "月", "火", "水", "木",
"金", "土"
],
minDate: new Date,
currentText: '今日を選択',
closeText: '確定',
onClose: function(dateText, inst) {
$(this).datepicker(
'setDate',
new Date(inst.selectedYear,
inst.selectedMonth,
inst.selectedDay));
}
});
$(this).keydown(function(e) {
e.preventDefault();
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>