No #detailsNavigation in your HTML.. and why not simply $ (".metaSection a").click(function(){... ? Also you can swap $thisA.is (:not... for !$thisA.hasClass('noSwap'), much less overhead.
Despite that code looks fine, could you provide a working sample at jsbin.com or the likes? On May 1, 12:29 pm, pixeline <aplennev...@gmail.com> wrote: > Hello ! > I'm assigning a specific "swap position" behaviour on click to a list > of links, all sitting inside a multilevel unordered list with id > "detailsNavigation" > > That behaviour only concerns specific anchors and those with class > "noSwap" shouldn't ... swap. > > Can you explain me why this does not work? > > $("#detailsNavigation li ul li a").bind("click", function() > { > var $thisA = $(this); > var $thisLI = $thisA.parent(); > var $thisUL = $thisLI.parent(); > if ($thisUL.parents('li').is(':not("#metadesign, > #editions, #timeline, #related")') || $thisA.is(':not(".noSwap")')) > { > // do that swappin' thingy > } > > }); > > Here is the related html: > > <ul> > <li class="clearfix" id="metadesign"> > > <ul style="display: block;" class="detailsSubnav clearfix > selected"> > <li class="clearfix" style="width: 100%;"> > <ul class="metaSection clearfix"> > <li class="skinColor > metaSectionTitle">concepts</li> > <li><a class="ajax noSwap" href="http://m2.lab- > au.com/projects/f551/metadesign/concepts/8/"> > electrosensing</a></li> > </ul> > <ul class="metaSection clearfix"> > <li style="display: list-item;"> > <a class="ajax selected noSwap" href="http:// > m2.lab-au.com/projects/f551/metadesign/methods/ > referencing/">referencing</a> > </li> > <li class="skinColor > metaSectionTitle">methods</li> > <li class="inactive"><span > class="inactive">Data mining</span></li> > </ul> > </li> > </ul> > </li> > </ul> > > Thanks a lot for your help! > > Alexandre