Here is my demo code http://jsfiddle.net/Wwdmm/3/
But nothing is happening when I click on require. I want to click require and then change the font color of option2 and upon uncheck option2 removes its class.
What’s the mistake? The selection is there.
Thanks
jQuery(document).ready(function(){
$('#id_run_options_0').change(function(){
if (this.checked){
alert('checked');
$('#id_run_options_1').addClass('highlight-option2');
}else{
alert('unchecked');
$('#id_run_options_1').removeClass('highlight-option2');
}});
});
You could simplify your class switching using
toggleClassmethodjsFiddler demo