i trying to change background on radio button when someone choose it. I read a lot other theard and tried to do something similar with my code but without success.
Here is my HTML & CSS code. Do i need to use javascript to make this happend?
https://codepen.io/levskyy/pen/xxZWVqg
#frm_radio_10-0 input {
display: none;
}
#frm_radio_10-0 {
font-family: 'Oswald', sans-serif;
color:#fff;
font-size:23px;
border-style:solid;
border-color: #262626;
border-radius:25px;
width:50%;
text-align:center;
margin:auto;
padding-bottom:10px;
background-color:#000;
margin-bottom:10px;
}
#frm_radio_10-0:hover {
background-color:red;
-webkit-transition: all 200ms ease-in;
-moz-transition: all 200ms ease-in;
}
#frm_radio_10-0 input:checked {
background-color:blue;
-webkit-transition: all 200ms ease-in;
-moz-transition: all 200ms ease-in;
}
<div class="frm_radio" id="frm_radio_10-0">
<label for="field_r8kt5-0">
<input type="radio" name="item_meta[10]" id="field_r8kt5-0" value="1.0" data-invmsg="text invalid"> Text</label>
</div>
Fixed this by jQuery:
<script> jQuery(document).on("change","input", function(){
if(jQuery(this).is(":checked"))
jQuery(this).closest("label").addClass("checkedlabel");
});
</script>
and adding css for .checkedlabel