2012-09-23 67 views
0

我有兩個問題:jQuery的日期選擇器只月份和年份

  1. 按鈕「今天」不起作用,因爲日曆不與選擇的值進行初始化,並初始化當前月份。

  2. 我需要覆蓋onclick按鈕'完成' - 這是怎麼回事?

腳本:

$('.datefield_month').datepicker({ 
      changeMonth: true, 
      changeYear: true, 
      showButtonPanel: true, 
      dateFormat: 'MM, yy', 
      onClose: function (dateText, inst) { 
       var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val(); 
       var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val(); 
       $(this).val($.datepicker.formatDate('MM, yy', new Date(year, month, 1))); 
      } 
     }); 

觀點:

<input name = "Month" class = "datefield_month" value="@Model.Month.ToString("Y", Session["culture"] as CultureInfo)" type="text" id ="Month" /> 

回答

相關問題