0
我試圖在用戶更改JQuery UI Datepicker上的月/年時保持選定的日期。這裏是我的代碼:JQuery DatePicker Year dropdownlist在Firefox中消失
$("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」方法我打電話。如果你評論一下,這沒有問題。
你確定嗎:「input [class ='datePicker hasDatepicker']」通常datePicker是id而不是類。 – sikander 2012-02-13 18:51:49
這是正確的選擇器,它返回相應的輸入,我可以修改datepicker的其他方面。 – 2012-02-13 18:54:39
嘗試指定datepicker的dateFormat參數。 我能夠運行你的代碼(與不同的選擇器)就好了。 – sikander 2012-02-13 19:16:12