I have Jquery code that checks on .change status of HTML select element and when there’s change in select element it should check if certain radio button is active.
$('#select_ele').change(function(){
//
//... Doing all kind of fancy stuff here
//
if($('input[name="radio_button"]').val() == 'bp'){
alert('YO');
}
});
So the idea here was on change of select check if ‘bp’ radio button is active and if so then alert me.
Your code will always give you the
.val()of the firstname="radio_button"match it finds, whether or not it is checked.Instead, you should use the
checked-selector(docs) to get the one that is checked.