SO - 21965642
by Arun P Johny
HTML
<div class="test">Information that I want to be coloured</div>
<div>
<label><input type="radio" id="A" name="RadioGroup1" value="Y"/>Yes</label>
<br/>
<label><input type="radio" id="B" name="RadioGroup1" value="N"/>No</label>
</div>
CSS
.classGreen {
color: green
}
.test {
font-size:24px
}
.classRed {
color: red
}
JavaScript
jQuery(function () {
$('input[type=radio][name=RadioGroup1]').change(function () {
if (this.value == 'Y') {
$('.test').removeClass('classRed').addClass("classGreen");
} else if (this.value == 'N') {
$('.test').removeClass('classGreen').addClass("classRed");
}
})
})