我正在尝试让 Vanilla JS Datepicker 工作: https ://github.com/mymth/vanillajs-datepicker它抛出一个错误: TypeError: undefined is not an object on e.dataset.date 这是日期选择器代码中的错误,所以我不确定出了什么问题。这是我在函数中的标注: function setDate() { console.log('DatePickerCk: ' , Datepicker); // shows as 'class ue' - that doesn't seem right var cdate = $(mycell).attr('dc-oldval'); console.log('CurDate: ' + cdate); // ok - 02/07/2020 var dpelem = $(mycell).find('input'); $(dpelem).val(cdate); console.log('ValofInput: ' , $(dpelem).val()); // ok - "02/07/2020" console.log('DpElem: ' , dpelem); // ok - hovering over it in console highlights the element in the DOM var datepicker = new Datepicker(dpelem, { autohide: true, daysOfWeekDisabled: [], daysOfWeekHighlighted: [], defaultViewDate: cdate, nextArrow: '>>', prevArrow: '<<', todayBtn: false, todayBtnMode: 1, todayHighlight: true }); Datepicker.locales.en = { days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], daysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], today: 'Today', clear: 'Clear', titleFormat: 'MM y', format: 'dd/mm/yyyy', weekstart: 0 } } setDate();我在输入中看到日期,但日期选择器的下拉列表未显示。难道我没有正确调用它吗?我不确定问题是什么。
添加回答
举报
0/150
提交
取消