使用下面的代碼禁用過去的日期,但沒有工作禁用過去幾個月及年份使用jQuery
$("#card_expiry").datepicker({
format: "mm-yyyy",
startView: "months",
minViewMode: "months",
changeMonth: false,
changeYear: false,
stepMonths: 0
});
使用下面的代碼禁用過去的日期,但沒有工作禁用過去幾個月及年份使用jQuery
$("#card_expiry").datepicker({
format: "mm-yyyy",
startView: "months",
minViewMode: "months",
changeMonth: false,
changeYear: false,
stepMonths: 0
});
$("#card_expiry").datepicker({
format: "mm-yyyy",
startView: "months",
minViewMode: "months",
changeMonth: false,
changeYear: false,
stepMonths: 0,
minDate: 0,
});
WORKED:startDate:new Date() – user1109270
minDate:0
的minDate
類型:日期或數字或字符串
默認:空
最小可選日期。設置爲空時,沒有最小值。 支持多種類型:
日期:包含最小日期的日期對象。
數字:從今天開始的天數。例如2表示從今天開始的兩天,-1表示昨天。
字符串:由dateFormat選項定義的格式或相對日期的字符串。相對日期必須包含價值和週期對;有效期間爲「y」多年,「m」數月,「w」數週,「d」數日。例如,「+ 1m + 7d」表示從今天起一個月零七天。
Following code works for me:
$("#card_expiry").datepicker({
format: "mm-yyyy",
startView: "months",
minViewMode: "months",
changeMonth: false,
changeYear: false,
stepMonths: 0,
startDate: new Date()
});
您是否嘗試過'minDate:0'或'startDate:new Date()'? – Satpal
工作:startDate:新日期() – user1109270