1
你好可以有人知道是否有可能这样做?如何使用.find在jquery中正确获取值
$(document).ready(function(){
$('body').delegate('#check-hide-empty-table', 'click', function(){
if ($(this).is(':checked')) {
alert("checked")
$('table').find('tr td.test').parents('tr').hide();
}
else {
alert("uncheck")
$('table').find('tr td.test').parents('tr').show();
}
});
和PHP文件中像这样
</script>
<table id="myTable" class="table table-responsive table-hover table-striped table-fixed tablesorter">
<thead>
<th><input type="checkbox" value="hide" id="check-hide-empty-table"> Hide Empty</th>
</thead>
<tbody>
<?php
$first = false;
foreach ($data["data"] as $list) {
$isfull = $list["Players"] == $list["MaxUsers"] ? true : false;
?>
<tr class="tabClicker" data-tab="tabs-1" id="<?=$list["Id"];?>">
<td class= "test"><?= $list["Players"]."/".$list["MaxUsers"];?></td>
</tr>
<?php } ?>
</tbody>
</table>
我想要做的是,我想创建隐藏chechbox功能时$列表[ “玩家”] = 0但我搞不清如何到,所以我试图用取值为.find(TR td.test)如果.find(TR td.test)= 0,该表将被隐藏
如何做到这一点?此代码现在仍然是错误的。感谢您的任何帮助
感谢的人对你的答案,但我有问题,因为**
Yep - 这非常好,我也会修复它。 –