SyntaxFix
Write A Post
Hire A Developer
Questions
.has() seems to be designed for this purpose. Since it returns a jQuery object, you have to test for .length as well:
.has()
.length
if ($('div#hello').has(target).length) { alert('Target is a child of #hello'); }