Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在Meteor中使用Jquery$(this)_Javascript_Jquery_This_Meteor_Self - Fatal编程技术网

Javascript 在Meteor中使用Jquery$(this)

Javascript 在Meteor中使用Jquery$(this),javascript,jquery,this,meteor,self,Javascript,Jquery,This,Meteor,Self,如何在meteor中使用此函数?例如,我希望能够单击任何给定的元素,并找出它的类是什么。另外,我如何获得有关我使用Meteor单击的项目的信息?假设在代码中的某个地方有一个处理事件的模板: Template.tmpl_name.events = { 'click #logo': function (e) { // Instead of using $(this), you can do: var $this = $(e.target); // Your usual c

如何在meteor中使用此函数?例如,我希望能够单击任何给定的元素,并找出它的类是什么。另外,我如何获得有关我使用Meteor单击的项目的信息?

假设在代码中的某个地方有一个处理事件的模板:

Template.tmpl_name.events = {
  'click #logo': function (e) {
    // Instead of using $(this), you can do:
    var $this = $(e.target);
    // Your usual code here, e.g.:
    console.log($this.attr('href'));
  }
};