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

#121768
eking
Member

Okay I got it to work in the CMS! (I had to change some settings) I’m trying to use this same method to change a background color, but it doesn’t seem to work. At first I just thought that it was the CMS but I also can’t get it to work in JS fiddle.

http://jsfiddle.net/eak819/jmFe7/

Is something incorrect?

$(‘.lof-inner div.hot’).siblings(‘.lof-row’).addClass(‘blackred’);

When sibling .lof-row is found it will add .blackred then CSS takes over from there. I’ve also tried to use the .closest selector but no joy.