In one template, I have:
<template name="moviesTemplate">
<form>
<ul>
{{#each movies}}
<li>
{{title}} <input id="{{title}}" type="submit" value="Delete" />
</li>
{{/each}}
</ul>
</form>
</template>
When the user clicks Delete on the moviesTemplate, I want to find the id property of the input element from within the event in my javascript file:
Template.moviesTemplate.events = {
'submit': function (e, tmpl) {
e.preventDefault();
var theId = theButtonThatRaisedTheEvent.id.toString(); // <--- This is what I'm referring to
}
}
How can I find this element? I thought it was 'e', but I can't seem to get any Id out of it. Perhaps I misunderstand...
Edit 1:
Okay, so it seems that 'e' is the event, which doesn't contain any information related to the source element. How else do I go around accomplishing this? Do I need to rethink about how I'm doing this?