2011-08-03 54 views
-1

我有兩個日期選擇器「出發日期」和「返回日期」。一旦選擇了出發日期,我想停用除「返程日期」的出發日期週末外的所有日子。jquery datepicker禁用除本週末外的所有其他日子

例如,如果我選擇出發日期爲8月12日(星期五)。我應該只能看到8月12日,13日和14日選擇返回日期時啓用。

我嘗試了beforeShowDay選項,但無法提供正確的邏輯來實現。

我不認爲這個代碼將有助於

$('#depart_date, #return_date').datepicker({ 
     inline: true, 
     showButtonPanel: true, // show close and today buttons at the bottom 
     closeText: 'Clear',  // text for close button 
     dateFormat: 'mm/dd/yy', // date format 
     minDate: 0,    // restrict date range 
     maxDate: "+1M +10D", 
     firstDay: 1,   // set monday as start day for the week 
     beforeShow: function(input, inst){ 

     }, 
     beforeShowDay: function(date){ 
      // for 'return date' - disable all other days except for the weekend 
      // of 'depart date' 
     } 
}); 

回答

相關問題