2017-02-03 13 views
0

私はこのdatepickerに取り組んでいます。私のコードは別に問題なく動作しますが、アプリケーション全体で使用すると、日付ラベルの横に空のテキストボックスが表示されます。私はplunkrを作成しました。助けが必要。Jquery Datepicker for month and monthのみ

私の全体のコードが巨大であるので、check hereとしてください。

$(function() { 
    $('.date-picker').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).datepicker('setDate', new Date(year, month, 1)); 
     } 
    }); 
}); 

答えて

0

あなたはこの

<link rel="stylesheet"href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> 
<script src="//code.jquery.com/jquery-1.10.2.js"></script> 
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> 
<link rel="stylesheet" href="/resources/demos/style.css"> 

スクリプトを含める必要があります:ここに私のコードdatepicker.jsから1つのファイルだけです

$(function() 
    { $("#datepicker").datepicker({ 
     changeMonth:true, 
     changeYear:true, 
     yearRange:"-50:+50", 
     dateFormat:"yy-mm-dd" }); 
    }); 

そして

<label>Date</label><input type="text" name="datepicker" id="datepicker"/> 

この意志作業。

関連する問題