jquery target child element if parent contain link value code example
Example 1: check class exist in element by parent id in jquery
$(this).parent().find('.accordion-body').length == 1;
or you can use hasClass()
Example 2: check if element has childs jquery
if ( $('#myfav').children().length > 0 ) {
// do something
}