0
我是Meteor的新手。每当我点击按钮时,我想插入一个新表格。我在一个模板中实现了表格,但我不确定如何每次单击按钮时插入模板的实例。插入模板instncaes点击事件meteorjs
HTML
<template name="addTable">
<button type="button" id="addTables" class="btn btn-default" aria-label="Left Align">
</template>
JS
Template.addTable.events({
'click #addTables': function(e){
var button = $(e.currentTarget);
button.before(//I want to add code here to insert one instance of template Table here)
}
})
我想要的效果是点击一次按钮后,一个{{> Table}}
可以在HTML <button type="button" id="addTables" class="btn btn-default" aria-label="Left Align">
之前插入。任何人都有想法如何做到这一点?非常感谢!
嗨!谢谢回复。但是我仍然对如何在代码中精确插入一个模板实例(这里实际上是一个表格)感到困惑。 – yiyizheliu