【发布时间】:2013-12-20 16:10:17
【问题描述】:
我有一个包含多行的表格,每一行都有一个复选框:
<tr id="${user_id}" class="SearchAccount" style="height: 40px;">
<td>John</td>
<td>John</td>
<td>Smith</td>
<td>20/12/2013</td>
<td>
<div class="itoggle">
<input type="checkbox" name='${user_id}' value="member" class="editteamtextbox" />
</div>
</td>
</tr>
<tr id="${user_id}" class="SearchAccount" style="height: 40px;">
<td>Adam</td>
<td>John</td>
<td>Jones</td>
<td>20/12/2013</td>
<td>div class="itoggle">
<input type="checkbox" name='${user_id}' value="member" class="editteamtextbox" />
</div>
</td>
</tr>
当复选框更改时,我在设置“已选中”时遇到问题: 我使用以下代码执行此操作:
$('.editteamtextbox').iToggle({
easing: 'easeOutExpo',
keepLabel: true,
speed: 200,
onClickOn: function () {
$(this).closest('input').prop('checked', 'checked');
},
onClickOff: function () {
$(this).closest('input').prop('checked', 'false');
}
});
【问题讨论】:
-
只是好奇,你试过
$(this).prop('checked', true/false)吗?
标签: javascript html