Home › Forums › CSS › Apply class to parent if child div contains class › Re: Apply class to parent if child div contains class
January 16, 2013 at 2:42 pm
#121185
eking
Member
Hi, I’m new here but I saw TheDoc’s solution so I figured I should signup. I’m trying to add some colors to some CMS rendered code, and need a way to change a parent’s style, when an ID is present in the child. The problem is that new class is entered on all of the matching classes not just the one with the child.
if($(‘.lof-inner div’).hasClass(‘hot’)) {
$(“.lof-title”).addClass(“blinkurgent”);
}