I\'m really struggling to see how to do this. I want to check if a class exsits somewhere in one of the parent elements of an element.
I don\'t want to use any libra
My example for Vanilla JS, it's use a vanilla equivalent of parents() from jQuery
var htmlElement = ,
parents = [],
classExist;
while (htmlElement = htmlElement.parentNode.closest()) {
parents.push(htmlElement);
}
classExist = (parents > 0);
So your selector just to be a .className
And just check if parent is > 0