使用jQuery UI Datepicker Widget,我想检查用户是否在模糊时将特定的输入字段留空,如果是这样,则将日期值分配给altField的值。我的脑海里有这样的东西...
$(selector).datepicker({
dateFormat: 'yy-mm-dd',
onClose: function (date) {
if (!$(this).val()) {
//at this point, how can I assign my date to be the value of altField: "#hiddenInput"
}
else {
//...I just carry along and do something with my date...
}
}
});
可以使用datepicker小部件完成吗?
您可以使用引导日期选择器来解决此类问题。链接如下。https://bootstrap-datepicker.readthedocs.io/en/latest/#
我的Bootstrap 3版本的环境Datetimepicker:4.17.47
$("#dateTimePicker").on("dp.hide", function (e) {
console.log(e.date);
});