android.nick android.nick - 4 months ago 8
jQuery Question

jquery: if (target) is child of ('.wrapper') then (do something)

var target = $(this).attr("href");

if {target is child of ('.wrapper')} then (do something)


simple syntax? can someone show me the correct syntax here?

Answer
if($(target).parents('.wrapper').length > 0) {
   //do something...
}