views:

37

answers:

1

I have the following selector

$('#navigation ul li a').click(function(evt) {}

this get the elements i need, but also retries child elements.

ie i get me this as well

#navigation ul li li a  // extra li

Just wondering the best way to detect what level of the dom i am selecting.

+2  A: 

You can use the > which is a parent > child selector ..

look at Child Selector (“parent > child”)

you could use it something like this

$('#navigation>ul>li>a')
Gaby