I am trying to change a divs background color by clicking one of the images. The new DIV color should be the second part of the image id.
CSS
#box {
width: 200px;
height: 200px;
background-color: #3FA5D5;
}
.black {
background-color: #000000 !important;
}
.red {
background-color: #990000 !important;
}
.blue {
background-color: #990000 !important;
}
.green {
background-color: #990000 !important;
}
HTML
<div id="box">BGCOLOR TO CHANGE HERE</div>
<br />
<img id="color black" src="images/black.png" alt="" />
<img id="color red" src="images/red.png" alt="" />
<img id="color blue" src="images/blue.png" alt="" />
<img id="color green" src="images/green.png" alt="" />