jQuery UI Datepicker maxDate动态 [英] Jquery ui Datepicker maxDate dynamically
本文介绍了jQuery UI Datepicker maxDate动态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
早上好,我想动态控制我的日期选择器的maxDate.举例来说.:我在表单上的文本框上有一个日期为20/12/12的日期.
Good Morning, I'd like to control dynamically the maxDate of my datepicker. For examp. : I have a date on my form on a textbox with value 20/12/12.
我尝试了此操作,但无法正常工作,日历从我在文本框中输入的日期开始禁用了maxDate.您能帮我吗?
I tried this but is not working, the calendar is disabling the maxDate from the date i got on my textbox. Can you please help me with this:
$(function() {
var date = new Date();
var m = date.getMonth(), d = date.getDate(), y = date.getFullYear();
$("#Panel2nrFecha").datepicker({
minDate: new Date(y, m, d),
maxDate: $("#Panel2nrTextBox1").val(),
dateFormat: "dd/mm/y",
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3
});
});
推荐答案
初始化日期选择器之后,您可以像这样更改 maxDate
选项:
After you have initialized your datepicker, you can change the maxDate
option like this:
$("#Panel2nrFecha").datepicker('option', 'maxDate', $("#Panel2nrTextBox1").val() );
这篇关于jQuery UI Datepicker maxDate动态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文