2017-12-14 7 views
0

私はこのように見えること データをエクスポートする(月間名、曜日、日付・曜日)をしようとしているfengyuanchen /日付ピッカー
を使用しています:  custom output

オプションが見つかりましたが、正しく設定できません。カスタム「fengyuanchen /日付ピッカー」出力

$(document).ready(function() { 
 
$('[data-toggle="datepicker"]').datepicker(); 
 
});
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> 
 
<link href="https://fengyuanchen.github.io/datepicker/css/datepicker.css" rel="stylesheet"/> 
 
<script src="https://fengyuanchen.github.io/datepicker/js/datepicker.js"></script> 
 

 
<div data-toggle="datepicker" class=" docs-date input-date-picker-from"> 
 
    <div class="month" id="putMonthName">January</div> 
 
    <div class="date">5</div> 
 
    <div class="day" id="putDayName">Tuesday</div> 
 
</div>

単純に私は日付があなたがピックコールバックをオーバーライドすることによってこれを達成することができるはず応答のdiv

答えて

1

に移入することにしたいです。

$(document).ready(function() { 
 
    $('[data-toggle="datepicker"]').datepicker({ 
 
     autoPick: true, 
 
     pick: function(e){ 
 
      e.preventDefault(); 
 
      var pickedDate = e.date;    
 
      var month = $(this).datepicker('getMonthName'); 
 
      var date = e.date.getDate(); 
 
      var day= $(this).datepicker('getDayName'); 
 
      $(".month").html(month); 
 
      $(".date").html(date); 
 
      $(".day").html(day); 
 
      $(this).datepicker('hide'); 
 
     } 
 
    }); 
 
    
 

 
});
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> 
 
<link href="https://fengyuanchen.github.io/datepicker/css/datepicker.css" rel="stylesheet"/> 
 
<script src="https://fengyuanchen.github.io/datepicker/js/datepicker.js"></script> 
 

 
<div data-toggle="datepicker" class=" docs-date input-date-picker-from"> 
 
    <div class="month" id="putMonthName">January</div> 
 
    <div class="date">5</div> 
 
    <div class="day" id="putDayName">Tuesday</div> 
 
</div>

+0

あなたがチームメイトありがとう!!それは私が欲しかったものです! :) あなたは最後のビット私を助けることができますか?私は初期設定で今日の日付を見るためにデフォルトで必要です –

+0

私は私の答えを編集しました。 autoPick:trueを追加するだけで、プラグインが初期化後に自動的に初期日付を選択できるようにする必要があります。 – Eliellel

+0

私はすでにこれを試しています、それは動作しません、ピッカーから月または日を変更しようとすると、後で正しく追加されません –