0
我有這樣的代碼流星onrendered使用jQuery的時候做的工作每個
Template.drone.onRendered(function() {
var userid = Meteor.userId();
$('.table > tbody > tr').each(function() {
var friendid = $(this).find("td:first").html();
var userid = Meteor.userId();
alert('this rendered inside each');
});
});
,這是模板
Template name="drone">
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Names</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{{#each allusers }}
<tr>
<td class="buttonId">{{_id}}</td>
<td>{{profile.name}}</td>
<td class="buttonAction">hi</td>
</tr>
{{/each}}
</tbody>
</table>
</template>
上面迭代的代碼表,並做一些事情與數據非常有用,從錶行,即id在每個td。
我想知道爲什麼這個代碼alert('this rendered inside each');
永遠不會觸發。