如何在windows .js上应用jQuery

时间:2022-10-25 19:42:25

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.

我对流星´已经创建一个模板。js,我想对tran_button上的onclick事件应用jQuery效果,效果的想法是与button相关的div消失。通过流星´我不得到任何错误控制台,或者firebug控制台。

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

Thanks.

谢谢。

2 个解决方案

#1


3  

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

将事件传递给函数并从event. currenttarget获取id:

Template.tran.events({
    'click .tran_button' : function(event){
        $('#' + event.currentTarget.id).slideUp('slow');
    }
});

#2


5  

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

$(event.target).slideUp(“慢”);

#1


3  

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

将事件传递给函数并从event. currenttarget获取id:

Template.tran.events({
    'click .tran_button' : function(event){
        $('#' + event.currentTarget.id).slideUp('slow');
    }
});

#2


5  

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

$(event.target).slideUp(“慢”);