Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Apply class to parent if child div contains class Re: Apply class to parent if child div contains class

#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”);

}