I am trying to allow folding and unfolding of a nested list by either clicking the li
or the input type=[checkbox]
adjacent to the li
. But checking the checkbox causes firing of the container li
causing the parent li
to fold.
Easier explained by this fiddle
I solved it by setting a global
window.checkbox_checked = true
show in this fiddle but I'de rather not use a global. Is there a cleaner way of doing this? I tried using event.stopImmediatePropagation()
and event.stopPropagation()
but neither worked for me?
Thanks
Update
As pointed out by Felix King, my problem was wrapping my li
in a div
, which disabled event.stopPropagation()
solution