check if element is parent of other element jquery code example
Example: check class exist in element by parent id in jquery
$(this).parent().find('.accordion-body').length == 1;
or you can use hasClass()
$(this).parent().find('.accordion-body').length == 1;
or you can use hasClass()