2012-04-26 12 views
2

jqueryカレンダーから変更されたコードを使用していますが、jqueryカレンダーは使用していますが、過去の年を追加して日を選択できません。このカレンダーでどうすればいいですか?これは、HTMLファイルで使用される変更したスクリプトはこれです: -jqueryカレンダーに過去の年を追加する方法

<script> 
     $(document).ready(function() { 
     $(".datepicker").datepicker({ 
      changeMonth: true, 
      changeYear: true, 
      showButtonPanel: true, 
      dateFormat: 'dd 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).datepicker('setDate', new Date(year, month, 1)); 
      }, 
      beforeShow : function(input, inst) { 
       if ((datestr = $(this).val()).length > 0) { 
        year = datestr.substring(datestr.length-4, datestr.length); 
        month = jQuery.inArray(datestr.substring(0, datestr.length-5), $(this).datepicker('option', 'monthNames')); 
        $(this).datepicker('option', 'defaultDate', new Date(year, month, 1)); 
        $(this).datepicker('setDate', new Date(year, month, 1)); 
       } 
      } 
     }); 
     }); 
     </script> 
+0

年以上なりますがスタックオーバーフローへようこそ。 [faq](http://stackoverflow.com/faq)を読んでください。誰かの回答があなたの質問に答えている場合は、その[回答](http://meta.stackexchange.com/a/5235/171243)の横にあるチェックマークをクリックすることを忘れないでください。 –

答えて

3

このお試しください:今年の範囲

$(".datepicker").datepicker({ 
    yearRange: '1700:2050', 

をあなたは

+0

ありがとうございましたJonathanRomer it works !!!!! – spsingh

関連する問題