Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply jQuery on Meteor.js

Tags:

jquery

meteor

I´ve create a template for meteor.js, what I want is to apply a jQuery effect for an onclick event on tran_button, the idea with the effect is that div associated to button disappear. I don´t get any error through meteor console, or firebug console.

Template.tran.events({
    'click .tran_button' : function(){
       $(this._id).slideUp('slow');
     }
});

Thanks.

like image 372
lfergon Avatar asked Jan 10 '13 21:01

lfergon


2 Answers

$(event.target).slideUp('slow');

like image 129
user2297128 Avatar answered Nov 08 '22 00:11

user2297128


Pass the event to the function and get id from event.currentTarget:

Template.tran.events({
    'click .tran_button' : function(event){
        $('#' + event.currentTarget.id).slideUp('slow');
    }
});
like image 26
ram1 Avatar answered Nov 08 '22 02:11

ram1