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 - 這非常好,我也會修復它。 –