2013-10-17 73 views
0

我有形式的搜索检查有效日期选择器

<b><span>@Html.Raw(Generic.ToDate):&nbsp</span></b><span>@Html.DateEmpty("ToDate", (DateTime?)ViewBag.ToDate)</span> 
<b><span>@Html.Raw(Generic.FromDate):&nbsp</span></b><span>@Html.DateEmpty("FromDate", (DateTime?)ViewBag.FromDate)</span> 

我的js代码输入日期选择器:

$("input[type=date]").each(function() { this.type = "input" }).datepicker(); 

我要检查确认没有fromdate < TODATE和日期> “30/9/2013”​​。请谁可以帮助我。

回答

0

date range

JS

$(function() { 
    $("#from").datepicker({ 
     defaultDate: "+1w", 
     changeMonth: true, 
     numberOfMonths: 3, 
     onClose: function (selectedDate) { 
      $("#to").datepicker("option", "minDate", selectedDate); 
     } 
    }); 
    $("#to").datepicker({ 
     defaultDate: "+1w", 
     changeMonth: true, 
     numberOfMonths: 3, 
     onClose: function (selectedDate) { 
      $("#from").datepicker("option", "maxDate", selectedDate); 
     } 
    }); 
}); 

HTML

<label for="from">From</label> 
<input type="text" id="from" name="from" /> 
<label for="to">to</label> 
<input type="text" id="to" name="to" /> 
+0

我想保存使sesion日期去我iput,例如:去我输入2013年10月9日克利克后搜索输入保存10/9/2013,但现在去输入10/9/2013之后踢iput disble值10/9/2013,文本框是emty。请帮帮我 – user2888692

相关问题