So I have circle divs that are supposed to have a black background once the radios linked to them are checked (this is for a carousel that automatically cycles through javascript). However for some reason it just does not work for me. I tried just manually changing the background to black and it seems fine. Please help :(
this is the css
#radio1:checked ~ .navigation-auto .auto-btn1{
background: black;
}
#radio2:checked ~ .navigation-auto .auto-btn2{
background: black;
}
#radio3:checked ~ .navigation-auto .auto-btn3{
background: black;
}
#radio4:checked ~ .navigation-auto .auto-btn4{
background: black;
}
#radio5:checked ~ .navigation-auto .auto-btn5{
background: black;
}
for the html it's cut in the middle due to other things but this is what's important
<div class="slides">
<input type="radio" name="radio-btn" id="radio1">
<input type="radio" name="radio-btn" id="radio2">
<input type="radio" name="radio-btn" id="radio3">
<input type="radio" name="radio-btn" id="radio4">
<input type="radio" name="radio-btn" id="radio5">
.....rest of code
and
<div class="navigation-auto">
<div class="auto-btn1"></div>
<div class="auto-btn2"></div>
<div class="auto-btn3"></div>
<div class="auto-btn4"></div>
<div class="auto-btn5"></div>
</div>
I'm not sure if this is enough information but please let me know if you need more. again, the divs did change color when i manually changed it, but the #radio:checked functionality does not seem to work for me.
this is the javascript
var counter = 1;
setInterval(function(){
document.getElementById('radio' + counter).checked = true;
counter++;
if(counter >5){
counter =1;
}
}, 5000);