if element parent has class jquery 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: jquery has parent with class
if ($elem.parents('.left').length) {
}