How to get a parent element from an each in meteor?

346 views Asked by At

I need to change the background color of particular parent element in an each.

html:

<template name="List">
 <div class="listclass">
   {{#each namelist}}
     <div class="panel">
        //some content
        <div class="shortlist">
           Click here shortlist
        <div>
     </div>
   {{/each}}
 </div>
</template>

js:

Template.List.events({
  'click .shortlist' : function(event, template){
    //I need to change the $(".panel") backgroud color.
  }
})
1

There are 1 answers

0
Ramesh Murugesan On

Let me answer my question.this may help someone.

$(event.currentTarget).parents('.panel').css("background","#FF6D00");