【问题标题】:Meteor Event: Children of list elementMeteor 事件:列表元素的子元素
【发布时间】:2017-03-21 11:40:34
【问题描述】:

我有以下

<template name="configs">
  <ul>
    {{#each config in configs}}
      <li>{{config.title}}
        <span>{{config.url}}</span>
      </li>
    {{/each}}
  </ul>
</template>


Template.configs.events = {
 'click li': function(e) {
   Meteor.call('foo', $(e.target).children('span').html();, function(err, response) {
     });
  }
};

我想在单击列表元素后接收“span”-text()-value。不幸的是,实际的方法总是导致一个空对象。是否有我必须应用的特殊 Meteor 逻辑?

提前谢谢你。

【问题讨论】:

    标签: jquery meteor html-lists meteor-blaze


    【解决方案1】:

    改变

    Template.configs.events = {
    
     'click li': function(e) {
       var txt =  e.target.textContent;
       Meteor.call('foo', txt, function(err, response) {
         });
      }
    };
    

    【讨论】:

    • 我找到了解决方案。不过,谢谢您的意见。
    猜你喜欢
    • 2021-03-21
    • 2016-01-31
    • 1970-01-01
    • 2023-03-09
    • 1970-01-01
    • 1970-01-01
    • 2015-09-14
    • 1970-01-01
    • 2018-05-19
    相关资源
    最近更新 更多