2016-05-02 89 views
2

私のdatepicker jQueryクラスを削除するためにデフォルトの日を削除する必要があります。別の解決策がありますか?jquery datepickerのデフォルトの日付を削除します

$('#calendar .ui-datepicker-days-cell-over').removeClass('ui-datepicker-days-cell-over'); 
$('#calendar .ui-state-hover').removeClass('ui-state-hover'); 
$('#calendar .ui-datepicker-current-day').removeClass('ui-datepicker-current-day'); 
$('#calendar .ui-state-active').removeClass('ui-state-active'); 

答えて

1

デフォルトでは、nullに設定されています。あなたのデフォルトの日が別の日に設定されている理由は分かりません。しかし、次のようにnullにリセットすることができます。

$("#datepicker").datepicker({ 
    defaultDate: null 
}); 

this jsFiddleを参照してください。

+0

Thx、私は "$(calendar).datepicker(" option "、" defaultDate "、null);"オプションbeforeShowDayとそれの仕事の後に。 しかし、今月のボタンをクリックして今月に戻ったとき、最初の日付は「選択不可能」ではなく、「現在の日」と定義されています。どうして ? – Luger33

+0

jsFiddleを表示できますか?私はあなたが意味するものを得ることができません。 – Qianyue

0
<!doctype html> 
    <html lang="en"> 
    <head> 
     <meta charset="utf-8"> 
     <title>jQuery UI Datepicker - Default functionality</title> 
     <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> 
     <script src="http://code.jquery.com/jquery-1.10.2.js"></script> 
     <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script> 
     <style type="text/css"> 
     .ui-datepicker-calendar .ui-datepicker-days-cell-over.ui-datepicker-today a 
     { 
     background: #e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") repeat-x scroll 50% 50% !important; 
     border: 1px solid #d3d3d3 !important; 
     color: #555555 !important; 
     } 

     </style> 
     <script> 
     $(function() { 
     $("#datepicker").datepicker(); 
     }); 

     </script> 
    </head> 
    <body> 

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


    </body> 
    </html> 
関連する問題