A
André Hänsel
Hi,
I have a nested list:
<ul>
<li>Link 1</li>
<li>Link 2</li>
<li id="sublist">Sublist
<ul>
<li>Sublink 1</li>
<li>Sublink 2</li>
</ul>
</li>
</ul>
I have set an event handler on the "sublist" LI that toggles the
visibility of the contained UL.
But now when someone clicks Sublink 1 or 2 the UL is hidden, because
the UL is in the LI and so the LI receives the event. How can I
prevent this?
I tried setting an event handler on the innermost LI's (with Sublink 1
and 2) and calling stopPropagation() from there but that did not even
work. However it would be an ugly way.
Regards,
André
I have a nested list:
<ul>
<li>Link 1</li>
<li>Link 2</li>
<li id="sublist">Sublist
<ul>
<li>Sublink 1</li>
<li>Sublink 2</li>
</ul>
</li>
</ul>
I have set an event handler on the "sublist" LI that toggles the
visibility of the contained UL.
But now when someone clicks Sublink 1 or 2 the UL is hidden, because
the UL is in the LI and so the LI receives the event. How can I
prevent this?
I tried setting an event handler on the innermost LI's (with Sublink 1
and 2) and calling stopPropagation() from there but that did not even
work. However it would be an ugly way.
Regards,
André