Since every item you want to hook up listeners to, and only those, are
contained in one and the same element (the UL), you'd probably be
better off just using event bubbling and only hooking up a listener to
the UL. For example:

$('ul').click(function (e) { e.stopPropagation(); var target = $
(e.target); if (target.is('a')) { /* link handler */ } else if
(target.is('li')) { /* item stuff */ });

Regarding if this is the expected behaviour or not with live events,
I'll leave to someone else to comment.

--
Frode

On Jan 19, 11:21 am, Walther <[email protected]> wrote:
> I am having a issue with the live event functionality in jQuery 1.3.
>
> Basically, I have a list with various options in this form:
> <ul>
> <li><a href="something">Bla</a></li>
> .
> .
> .
> .
> </ul>
>
> I want to do something when the user clicks on the list item (it has a
> rather wide width), and I want to do something else when the user
> clicks on the link inside the list item. Since the list is going to be
> a dynamic list I need to use live events.
>
> However, when I use live events and click on the <a> tag, the event
> for the list item is also fired. I have tried putting return false;
> and event.stopPropagation(); into the event function, it doesn't work.
> However, when  I use the normal bind() function (instead of live()) it
> works as intended(expect for it not being a live event which I want).
>
> I am guessing that I am doing something stupid that is preventing it
> from working, any help would be apprechiated.
>
> Regards
> Walther
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to