从 meteor 中的 table 中的特定行获取值
getting values from a specific row in a table in meteor
我有一个 table 看起来像这样:
{{#each names}}
...
<td id="fullNameID">{{fullName}}</td>
<td>{{otherFields}}</td>
...
{{/each}}
我还有一个删除按钮作为每一行的删除按钮之一。我究竟如何获得该行中显示的全名?
我试过
$('#userRoleTable #fullNameID').text());
但是,每一行的全名都被拾取了。 (例如姓名 1 姓名 2 姓名 3 ...)
我认为这是重复的。同样的问题已被问及回答 here。
不过,你要找的答案可能是:
$(this).closest('tr').children('td#fullNameID').text();
这假定您的 table 单元格与删除按钮在同一行内。
我有一个 table 看起来像这样:
{{#each names}}
...
<td id="fullNameID">{{fullName}}</td>
<td>{{otherFields}}</td>
...
{{/each}}
我还有一个删除按钮作为每一行的删除按钮之一。我究竟如何获得该行中显示的全名?
我试过
$('#userRoleTable #fullNameID').text());
但是,每一行的全名都被拾取了。 (例如姓名 1 姓名 2 姓名 3 ...)
我认为这是重复的。同样的问题已被问及回答 here。
不过,你要找的答案可能是:
$(this).closest('tr').children('td#fullNameID').text();
这假定您的 table 单元格与删除按钮在同一行内。