My input field looks like this
<div>
<div>
<input type="radio" name="radioBtn" value="true" id="radioYes" class="radioBtn"/><br />
<span>Yes</span>
</div>
<div>
<input type="radio" name="radioBtn" value="true" id="radioNo" class="radioBtn"/><br />
<span>No</span>
</div>
</div>
When a user clicks on these radio buttons, I'm firing up a click event and I want to change the colour of the radio button. I've tried the following, but no luck. It does not seem to change the colour of the radio button to red. Any I missing something here?. or am I doing something wrong?. Any inputs are highly appreciated.
Thanks in advance.
$("input[name^='radioBtn']").click(function (event) {
//Change color of radio button to red
$(".radioBtn").css("color","red");
if($("#radioYes").is(':checked')) {
//Do something
}else{
//Do something
}
});
NOTE: I want to change the colour of the radio button only when a click event is triggered. I'm specifying this because there are other calls that modify the value of this radio button however they are not triggered on click event.