<template name="actionTemplate">
{{#each action}}
<button class="myButton" id={{_id}}>btn</button>
{{> action}}
{{/each}}
</template>
<template name="action">
<div class="sct" id={{_id}}>
some text has to display
</div>
</template>
for the above line how do I write click function to hide the "btn" button.
If your template is named say actionTemplate
, you should write a event function as
Template.actionTemplate.events({
"click .myButton" : function(event){
var id= event.currentTarget.id;
$('#'+id).hide();
});
This should do the job.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.