Change background of <div> when clicking a link inside a different <div>

Sorry it’s late and I’m frazzled and just want a little help with this :slight_smile:

Is there an easy way to change the background colour of a <div> when you click on a link that is inside a totally different <div>?

For example:

<div class ="header">
< a href="about" class="divColourChanger">When I click this link (see below div)</a>

<div class="about">It changes this DIVs background colour!</div>

I’m sure there was an easy way to do this in CSS however I have to go to bed and who knows, this might be useful for someone else as well :slight_smile:

You would have to do that with javascript like this:

<p><a href=‘#’ onclick = “document.getElementById(‘dd’).style.backgroundColor = ‘red’;”>click me</a></p>

<div id=‘dd’ style=‘background-color: blue; height: 100px; width: 100px’></div>

That’s wonderful. Thank you so much :slight_smile:

No problem, enjoy