[英]Get dateinput max and min date
您可以嘗試以下方法:
$(":date").dateinput({
format: 'dddd dd, mmmm yyyy', // the format displayed for the user
selectors: true, // whether month/year dropdowns are shown
min: -100, // min selectable day (100 days backwards)
max: 100, // max selectable day (100 days onwards)
offset: [10, 20], // tweak the position of the calendar
speed: 'fast', // calendar reveal speed
firstDay: 1, // which day starts a week. 0 = sunday, 1 = monday etc..
change: function (a) {
console.log($(this)[0].getConf().min);//min value
console.log($(this)[0].getConf().max);//max value
}
});
HTML:
<input type="date" name="date1" value="Today" />
<input type="date" name="date2" value="10 days from now" min="2010-03-01" max="2012-01-01" class="one" />
<input type="date" name="date3" value="15" min="-25" max="25" data-value="15" />
演示: http : //jsfiddle.net/GCu2D/159/
除了change
功能之外,它還具有onShow
和onHide
,以防萬一您想稍后或在演出中使用min max。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.