What do you actually need to accomplish? Depending on what you want to do there are different ways of doing it ....
If you have nested links in a div and you only want to fire an event handler if one of those links inside that div was clicked then you could use
on() to this:
- $("#divID").on("click", ".linkClass", function() {
- // handler code
- });
If you need to find out if a specific element has a specific parent you can use
parent() or
parents() and check the length of the returned object.
- $(".linkClass").click(function() {
- if ($(this).parent("#divID").length > 0) {
- // handle it
- }
- });
And there are other things that might work better, depending on your ultimate goal.
Dave