How to get the value of click event in meteor Js For example i want {{name}} this value.Here is put my code it showing *undefined*in alert box.Please verify and suggest me.
client JS:
Template.client.events({
    'click .clientrow':function(e,t){
         console.log("You Select Client Row ");
         e.preventDefault();
         alert($(e.target).closest('tr').data('_id'));
    }
});
template:
<template name="client">
<tbody>
    {{#each clientList}}
    <tr class="clientrow">
       <td data-id="{{_id}}">{{cid}}</td>
       <td>{{mrno}}</td>
       <td>{{client}}</td>
       <td>{{formatDate rdate}}</td>
       <td>{{referredby}}</td>
       <td>{{clinecian}}</td>
       <td>{{serviece}}</td>
       <td>{{episode}}</td>
       <td>{{actions}}</td>
    </tr>
     {{/each}}              
  </tbody>
</template>
                You can easily access the element that was clicked:
'click .something': function(e, t) {
  $(e.target);
}
Now, if you want the data stored in a row that was clicked, you can easily make it accessible with data HTML parameters
{{#each items}}
  <tr data-name="{{name}}" data-id="{{_id}}">...</tr>
{{/each}}
Afterwards, extract it from the row:
'click .something': function(e, t) {
  alert($(e.target).closest('tr').data('name'));
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With