lundi 16 octobre 2017

How can I hide the closest element with a specific class?

I want to hide .panel when the checkbox is checked. But it is not hiding:

 $(".done").on("change", function () {
   if ($(this).is(":checked")) {
     $(this).closest(".panel").hide;
   } 
});
<script src="http://ift.tt/1oMJErh"></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>



Aucun commentaire:

Enregistrer un commentaire