jquery issue if checked change bg color
- by user3058067
Hello i made a script that is supposed to change background when radio is selected. It works but when another radio is selected the previous still remains with the selected color. It works for checkboxes but not for radio.
<script type="text/javascript">
$(".table").change(function(){
var c = this.checked ? "#18b9e7" : "#b6bf34";
$(this).parent().css("background-color", c);
});
</script>
Here is a jsfiddle