当用户 Select 日期以显示它所在的日期时,我会try 添加一个隐藏字段.我查看了有关使用日期格式的文档,但似乎无法呈现它.因此,日期显示在字段中,如:01/01/2024,但我希望 Select 将日期添加到字段值中,或者将其作为隐藏字段显示在其他位置.IE:01/01/2024星期一
https://jqueryui.com/datepicker/ jQuery DateTimePicker
$("input.Date").datepicker({
onSelect: function (dateText, inst) {
$("#" + this.id + "_month").attr("value", new Date(dateText).getMonth() + 1);
$("#" + this.id + "_day").attr("value", new Date(dateText).getDate());
$("#" + this.id + "_year").attr("value", new Date(dateText).getFullYear());
$("#" + this.id + "_changeTime").val(Date.now()).trigger('change');
},
changeMonth: true,
changeYear: true,
yearRange: '1900:2050',
showButtonPanel: true,
showOn: 'both',
buttonText: 'Date',
buttonImageOnly: true,
closeText: 'Close',
showAnim: '',
dayNamesShort: true
});