I am working with this code: (Updated)
<script>
$(function(){
//Radio Item 1
$("#radio1").change(function() {
$("#defaultwrapper").addClass("background_color_selected");
$("#default_wrapper").removeClass("def_background_color");
});
//Radio Item 2
$("#radio2").change(function() {
$("#default_wrapper2").addClass("background_color_selected");
$("#default_wrapper2").removeClass("def_background_color");
});
});
</script>
My problem is that I need the background-color of the selected radio to change and it’s not toggling right now
(Update)
In jQuery no event is fired when radio is unselected. Try to create global handler:
For html:
Working sample: http://jsfiddle.net/THrYJ/