流星将按钮值设置为会话

时间:2022-06-04 19:40:34

I would like to be able to save a value from a button into a session variable on click. fyi- The button does not submit anywhere. I hope I am using the terminology correctly, if not please correct me.

我希望能够在点击时将按钮中的值保存到会话变量中。 fyi-按钮不提交任何地方。我希望我正确使用这个术语,如果不是,请纠正我。

Here's what I have:

这就是我所拥有的:

<button class="button button-small button-stable" data-ion-modal="_Modal" value="November-26-2015">'26'</button>

Template.calendar.events({
  'click .button' : function() {
   var value = this.value;
   Session.set( "DateEditing", value);
   var clickedDateValue = Session.get('DateEditing');
  }
});

1 个解决方案

#1


0  

Try this:

Template.calendar.events({
  'click .button' : function(event, template) {
     var value = event.currentTarget.value;
     Session.set("DateEditing", value);
  }
});

#1


0  

Try this:

Template.calendar.events({
  'click .button' : function(event, template) {
     var value = event.currentTarget.value;
     Session.set("DateEditing", value);
  }
});