jquery check if parent has class 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()