I have a treelist
containing multiple levels of checkboxes
and I am trying to get the parent checkbox
to show as 'checked'
when any of children checkboxes
are clicked. For some reason this is not working and it's killing me.
JAVASCRIPT
$(function() {
$("input.boundChild[type=checkbox]").click(function() {
$(this).closest("input.boundParent").prop("checked", "checked");
});
});
HTML
<ul>
<li class="collapsed expanded">
<input id="0" class="boundParent" type="checkbox" >
Australia
<ul style="display: block;">
<li>
<input id="0/" class="boundChild" type="checkbox" checked="">
<input type="hidden" value="Intel Australia PTY Ltd.">
</li>
</ul>
</li>
</ul>