Reputation: 4703
Passing two class to meteorjs click event. I have two buttons save and close which have same functionality and i want to target them using meteor events. I know i can assign them same class or create two separate events.
But is there any way to target it with something like below code.
//This does not work
Template.layout.events({
'click .close .save': function() {
//do something here
},
I can do this but is there any better way.
Template.layout.events({
'click .close': function() {
//do something here
},
Template.layout.events({
'click .save': function() {
//do something here
},
Upvotes: 0
Views: 120
Reputation: 36511
You just need to comma-separate the events:
Template.layout.events({
'click .close, click .save': function() {
//do something here
},
Upvotes: 2