Reputation: 470
My problem: I have multiple instances of the 'myTemp' template on the page. When I click on the button inside of the first instance that was created, 'remove me' is displayed in console as it should. Unfortunately, when I click on the delete button in any of the other instances of 'myTemp' I do not get 'remove me' in console. I don't understand why this is happening. How is it possible to remove each instance by clicking on it's delete button?
Thanks, Nathan
myTemp.html
<template name="myTemp">
<button type='button' class="btn remove">Delete</button>
</template>
myTemp.js
Template.myTemp.events({
'click .remove': function(e){
console.log('Remove me!');
}
});
Upvotes: 0
Views: 101
Reputation: 667
With class your code is fine but if you use id it will not be as ids are supposed to be unique on the page.
Upvotes: 1