1

我有代码 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 <input type="text" id="from" name="from" /> <label for="to">to</label> <input type="text" id="to" name="to" />

我想在每个选择的文本中保存值,现在我选择了它禁用的日期我选择了,请帮助我

4

1 回答 1

1

工作演示,以便您可以选择过去的日期: http: //jsfiddle.net/vfnjQ/http://jsfiddle.net/eff4J/

我认为您的问题是,旧日期变得像这样被禁用:http: //jsfiddle.net/eff4J/1/

要启用日期,请设置startdate`datepicker.

希望休息适合你的事业:)

代码

$(function () {
    $("#from").datepicker({
        defaultDate: "+1w",
        changeMonth: true,
        numberOfMonths: 3,
        startDate:'01/01/2000', 
        onClose: function (selectedDate) {
          //  $("#to").datepicker("option", "minDate", selectedDate);
        }
    });
    $("#to").datepicker({
        defaultDate: "+1w",
        changeMonth: true,
        numberOfMonths: 3,
        startDate:'01/01/2000',
        onClose: function (selectedDate) {
          //  $("#from").datepicker("option", "maxDate", selectedDate);
        }
    });
});
于 2013-10-18T03:19:54.477 回答