Forums

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

Home Forums CSS To select a specific parent tag. Re: To select a specific parent tag.

#114069
Senff
Participant

You can use jQuery, I’d say:

$(‘.apple’).parent().addClass(‘highlight’);

This will add a class “highlight” to the LI if it contains a child with class “apple”. Sounds kinda obvious, but the fact that it wasn’t suggested already makes me wonder if there’s something wrong with it…..?