如何解决车把中的点击事件?

时间:2014-11-26 10:38:59

标签: javascript jquery html css backbone.js

    /* I have a handlebar template as */
        <strike><div id="tab-template-id" class="citi-layouts-container">
          <div id="tabRegion" id="citi_apps_landing_heroContainer" >
          {{#each values}}
          <a id="{{id}}" class="btn-large">{{id}}</a>
           {{/each}}                
         </div></strike>
  /* problem: */
  /*  I could not able to click the dynamically created button id

使用骨干js * /

在布局中使用事件

1 个答案:

答案 0 :(得分:2)

&#13;
&#13;
render() {
  var count = 15;
  var Data1 = [];
  for (var i = 0; i < count; i++) {
    Data1.push({
      id: "tab" + i
    });
  }

  var items = new Items(Data1);
  this.collection = items;
  $(this.el).html(this.template({
      values: this.collection.toJSON()
    });
  $.extend("events", {"click .btn-large": "your function"})
  }
&#13;
&#13;
&#13;