gpt4 book ai didi

javascript - 如何使用 Meteor 将列表每一行的列值存储到集合中?

转载 作者:行者123 更新时间:2023-12-02 16:25:37 25 4
gpt4 key购买 nike

我有一个单列表,表中的每个条目都是一个文本区域。用户填写多行文本区域后,我想通过单击按钮将每个文本区域的数据存储在集合中。我怎样才能在 meteor 中做到这一点? HTML 模板如下所示:

<table id="myTable" class="table table-bordered">
<thead>
<tr>
<th>Notes</th>
</tr>
</thead>
<tbody>
{{#each items}}
<tr>
<td id="notes">
<textarea rows="4" cols="50">
</textarea>
</td>
</tr>
{{/each}
</tbody>
</table>

最佳答案

您可以尝试使用.each JQuery的方法。

示例:

Template.yourtemplate.events({
'click .button': function(e) {
$("textarea").each(function(i) {
YourCollection.insert($(this).val())
})
}
})

关于javascript - 如何使用 Meteor 将列表每一行的列值存储到集合中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28717575/

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