簡體   English   中英

將所選日期存儲在帶有流星的bootstrap 3日期時間選擇器上

[英]storing the selected date on bootstrap 3 date time picker with meteor

我在流星應用程序中使用bootstrap 3日期時間選擇器。 我正在嘗試存儲所選日期,以便以后使用。 當前僅嘗試在控制台中顯示所選日期。 當我運行程序時,我的日志中沒有錯誤,但是它也沒有在日志中顯示所選日期。 這是我的代碼HTML

<template name="teetimepicker">

<div class="input-group datetimepicker">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input class="set-due-date form-control" type="text"/>
</div>

</template>

.js

if (Meteor.isClient) {
 Template.teetimepicker.onRendered(function() {
 this.$('.datetimepicker').datetimepicker();
 });


function dateSelection(){
var selectedDate = $("#datetimepicker").data("datetimepicker").getDate();
console.log(selectedDate);
 };

同樣,我沒有控制台錯誤,但是日志中什么也沒有。 我需要存儲每個用戶的選定日期。 感謝您的任何幫助!

您需要設置一個附加到teetimepicker模板的事件,以處理日期選擇器中的日期更改。 它可能看起來像這樣:

Template.teetimepicker.events({
  "changeDate #datetimepicker": function(event, template) {
      console.log(event.currentTarget.)//whatever you need
  }
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM