I have tried to change the classname in the parent class when input checkbox is "checked" in the child class with no luck. Need it to be done with javascript, no Jquery.
<div class="parentBox">
<img src="pic.png" alt="Small pic" class="notChecked">
<div class="childBox">
<img src="pic.png"" alt="Bigger pic">
<input type="checkbox"><span>Sample picture</span>
</div>
</div>
I want to change the class name in the img tag in parentBox to "checked" when the input chechbox is checked. It will then change the css style so the user see that the image is selected. Try it out in the jsfiddle link.
Css code:
.notChecked {border: 1px solid black;}
.checked {border: 5px solid red;}
Here is jsfiddle link: http://jsfiddle.net/8LW6Q/