gpt4 book ai didi

javascript - 如何触发 Handlebars 中的点击事件?

转载 作者:太空宇宙 更新时间:2023-11-04 03:25:15 25 4
gpt4 key购买 nike

    /* 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

使用backbone js在布局中使用事件*/

最佳答案

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"})
}

关于javascript - 如何触发 Handlebars 中的点击事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27146959/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com