如何在jquery datepicker中一起设置minDate和defaultDate

问题描述

我试图在日期选择器中显示minDate:1和defaultDate:+3。

$( ".datepicker1" ).datepicker({
            dateFormat: "mm-dd-yy",altFormat: "yy-mm-dd",altField: "#altField",minDate: 1
});
$("#TTOCutoffDate").datepicker("option","defaultDate",3);
$("#fileDate").datepicker("option",3);

If I use html input Box,it works as expected.
<input type="text" name="fileDate" id="fileDate" class="datepicker1">

success picture

But If I use html.textBoxfor as below,it doesn't work.
<%=Html.TextBoxFor(x => x.TTOCutoffDate,ttoEnabled ? new {@class="datepicker1" } : (object)new { 
disabled = "disabled" })%>

TextBoxFor picture

似乎认日期未设置为认日期。

如何使其与TextBoxFor一起使用? html呈现如下。

<input type="text" name="fileDate" id="fileDate" class="datepicker1 hasDatepicker"> 
<input class="datepicker1 hasDatepicker" id="TTOCutoffDate" name="TTOCutoffDate" type="text" value="" readonly="" style="background-color: rgb(255,255,255);">

谢谢。

解决方法

您缺少fileDate ID