jquery if elements parent hasclass 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) {
}