2011-10-20 8 views
0

こんにちは私は2つのjquery日付ピッカーをfromdateとtodateの形式にしています。 ピッカーで次の機能が必要です todateが有効/有効になっているのは、fromdateが選択されている場合のみです。-js fromdlectのonselect()を呼び出しますか? todateには利用可能な日付があります。開始日から最大30日、30日後およびそれより前の日付は無効です。つまり、todateのmaxdateパラメータを設定しますか? これをどのように達成できるか知る必要があります。 ありがとう Priyankjquery datepicker disabling date

こんにちは私は働いていますが、カレンダーの無効化は起こっていません。ここに私の現在のtodateカレンダーの選択があります。現在、私はデフォルトで2番目のカレンダーを無効にしようとしていますが、有効にするためにonselect関数をまだ作成していませんが、無効にはなりません。これを行う他の方法? disabled = trueはdatetimepickerで機能していません。あなたはjQueryのUIの日付ピッカーを使用している場合 おかげ Priyank

<span class="labels">To Date</span> 
<input type="text" name="dateFrom" value="" id="datefrom"> 

<script> 
jQuery(function() { 
jQuery("#datefrom").datetimepicker({ dateFormat: 'yy-mm-dd', 
    showSecond: true, 
    timeFormat: 'hh:mm:ss', 
    changeMonth: true, 
    changeYear: true, 
    maxDate: new Date, 
    minDate: new Date('2011-08-02'), 
    showOn: "button", 
    buttonImage: "/calendar.png", 
    buttonImageOnly: true }); 
    onSelect: function enabletoDate(dateText, inst) { } 
}); 
</script> 

<span class="labels">To Date</span> 
<input type="text" name="dateto" value="" id="dateto"> 

<script> 
jQuery(function() { 
jQuery("#dateto").datetimepicker({ 
    disabled: true, 
    dateFormat: 'yy-mm-dd', 
    showSecond: true, 
    timeFormat: 'hh:mm:ss', 
    changeMonth: true, 
    changeYear: true, 
    showOn: "button", 
    buttonImage: "/images/users/calendar.png", 
    buttonImageOnly: true }); 
}); 

</script> 
+0

コードを投稿できますか? –

答えて

0

あなたは、ピッカーのためmaxDateのとMinDateプロパティのプロパティを設定することができます。

http://jqueryui.com/demos/datepicker/

+0

私はdatetimepickerを使用しています:Trent Richardson –