1

I am new with JQuery and I wanted to see if I could do something like this using JQuery UI datepicker.

I want to show from January 1 through March 30 of every year OR a specific year .. and disable other dates. The first picked date should be 5 business days from today.

Is it possible. I did see some range etc on JQuery UI but I did not quite understand.

Thanks

Update

I could do something like below able to get the users to select only 5 days from today.

minDate: +5, maxDate: "+3M +10D",

Update

                      showButtonPanel: true,
                      minDate: new Date(2012, 1, 2),
                      maxDate: new Date(2012, 3,30),
                      minDate: + 5
4

1 に答える 1

1

最小および最大の日付を指定できます。

HTML

<p>Date: <input type="text" id="datepicker"></p>

<p>New Date: <input type="text" id="test"></p>

</div>

JavaScript (2 つの異なる例。最初のハード セットの日付。2 番目は現在の日付 + 5 日を取得します。

  $(function() {
        $( "#datepicker" ).datepicker({
           minDate: new Date(2012, 0, 1),
           maxDate: new Date(2012, 2, 31)}
        );

        var today= new Date();
        var numberofDays = 5;
        var newDate = new Date().setDate(today.getDate()+numberofDays);
        $( "#test" ).datepicker({
           minDate: newDate,
           maxDate: 5}//number of days from the start date
        );
    });

jsfiddle を使用した例を次に示します

http://jsfiddle.net/rpNXZ/1/

</p>

</p>

于 2012-08-04T17:59:00.657 に答える