Hi, Not quite sure if I understood the problem - but if you mean that you only want the certain event triggered when you click on 1st-level a tags (same level as 1 Position), what you can do is use a next selector similar to:
$("ul.someclass > ul + li a").click({}); This way, the .click() event is attached only to all top-level <a> tags. The way you're selecting it now, in a sentence translates to: "select all li a elements that are children of ul.someclass". Regards, Jacob On Jun 5, 8:24 am, Argasek <[EMAIL PROTECTED]> wrote: > This is my first post here, so hello to all subscribers! > > I have googled a bit for my problem, but didn't find exact answer to > my problem, or I do not understand event propagation enough. The > situation looks like this: I have a nested list: > > <ul class="someclass"> > <li>1 Position... <a href="mailto:[EMAIL PROTECTED]">e-mail</a></ > li> > <li>2 Nested position > <ul class="nested"> > <li>1.1 Position... <a href="mailto:[EMAIL PROTECTED]">e- > mail</a></li> > ... > </ul> > </li> > </ul> > > There's an event (click; toggle, to be more exact) bound to each > ('ul.someclass > li'), making <ul> contained within this <li> > (ul.nested) appear/disappear. The problem is: the event is triggered > not only when I click on the "2 Nested position" label, but also when > clicking on any of this element (i.e. ul.someclass > li) descendants, > thus, preventing the "default action" for an anchor > (mailto:[EMAIL PROTECTED]). > > I have made a simple workaround: > $('.someclass > ul > li a').click(function(e) { > document.location.href = $(this).attr('href'); > return false; > }); > > which works, but I'm not quite happy with the solution. > > The question is: is there any way to easily prevent "propagation" > described above? > > I can provide a link to a live code, if needed. > > greetings, > Jakub