tags:

views:

36

answers:

1
var clicked = e.target;

$(clicked).attr("id") == #somemenu // this checks see if the clicked has id of somemenu.

now, my question is how can I determine whether this clicked element is a subset of somemenu ?

example html of somemenu:

<div id="somemenu">
<a href="something.php"> menu 1 </a>
//bunch of other elemnts here, can be anything.
</div>

I want to catch any element that is subset of somemenu div when it's clicked.

+1  A: 

This will work:

if ($(clicked).parents('#somemenu').length) {
    // I am a child of somemenu so do stuff.
}    
Stephen