チェックボックスをオンにした場合、.panel
を非表示にしたいと思います。しかし、それは隠れていません。特定のクラスで最も近い要素を非表示にするにはどうすればよいですか?
$(".done").on("change", function() {
if ($(this).is(":checked")) {
$(this).closest(".panel").hide;
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<li class="panel" style="background:#f4f4f4;">
<table style="width:100%">
<tbody>
<tr>
<td style="width:45px">
<span class="handle ui-sortable-handle">
</span>
<input class="done" type="checkbox">
</td>
<td>
<span style="min-width:100px;min-height:20px;margin-left:0px">Please hide this on check</span>
</td>
</tr>
</tbody>
</table>
</li>
'.hide'には'() 'がありません。タイプミスとしてクローズする投票 –