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();

我想检查 validate fromdate < todate and date > "30/9/2013"。请谁能帮助我。

4

1 回答 1

0

读取日期范围

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" />
于 2013-10-17T02:29:08.907 回答