I am trying to disable all past dates from the date-picker except for the last 2 dates. How can i do that?
我试图禁用日期选择器中的所有过去日期,除了最后2个日期。我怎样才能做到这一点?
<link href="Content/jquery-ui-1.8.23.custom.css" rel="stylesheet" />
<script src="Scripts/jquery-1.8.1.min.js"></script>
<script src="Scripts/jquery-ui-1.9.2.custom.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('.datepicker').datepicker();
});
</script>
here is my textbox
这是我的文本框
<asp:TextBox ID="txtDate" runat="server" CssClass="datepicker" >asp:TextBox>
2 个解决方案
#1
1
you can use minDate
option for this:
你可以使用minDate选项:
$( "#datepicker" ).datepicker({ minDate: -2});
#1
1
you can use minDate
option for this:
你可以使用minDate选项:
$( "#datepicker" ).datepicker({ minDate: -2});