JQuery DatePicker 年份下拉列表在 Firefox 中消失
当用户更改 JQuery UI 日期选择器上的月份/年份时,我试图保持所选日期。这是我的代码:
$("input[class='datePicker hasDatepicker']").each(function (index) {
$(this).datepicker("option", "onChangeMonthYear",
function (year, month, inst) {
var currDate = $(this).datepicker("getDate");
if (currDate)
$(this).datepicker("setDate", month + "/" + currDate.getDate() + "/" + year);
});
});
该代码在 IE 和 Chrome 中运行良好,但在选择日期并尝试更改月份/年份后,年份的下拉列表在 Firefox 中消失。有什么想法吗???谢谢。
编辑:
看起来该错误与我正在调用的“setDate”方法直接相关。如果注释掉就没有问题了。
I'm trying to maintain the selected date when the user changes the month/year on the JQuery UI Datepicker. Here's my code:
$("input[class='datePicker hasDatepicker']").each(function (index) {
$(this).datepicker("option", "onChangeMonthYear",
function (year, month, inst) {
var currDate = $(this).datepicker("getDate");
if (currDate)
$(this).datepicker("setDate", month + "/" + currDate.getDate() + "/" + year);
});
});
The code works fine in IE and Chrome, but the dropdownlist for the year disappears in Firefox after you select a date and try to change the month/year. Any ideas??? Thanks.
EDIT:
It looks like the error is directly related to the "setDate" method I'm calling. If you comment it out, there isn't a problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案是我应该立即检查的。我使用的是版本 jqueryui/1.8.12/jquery-ui.min。 js 以及当我更新到最新版本时jqueryui/1.8.16/jquery-ui.min.js 它工作正常。
The solution was something I should have checked right away. I was using version jqueryui/1.8.12/jquery-ui.min.js and when I updated to the latest version jqueryui/1.8.16/jquery-ui.min.js it works fine.