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