Showing/hiding a div (“#HIDEIFNO”) based on which radio button is checked.
If the possible values coming from teh buttons are “0” or '1", the below works great:
$(function(){
$("#inc_tc_cov").change(function () {
var val = $(this).val();
switch(parseInt(val)){
case 1:
$("#HIDEIFNO").show();
break;
case 0:
$("#HIDEIFNO").hide();
break;
default:
$("#HIDEIFNO").hide();
}
});
});
However, if I change the possible values to “Yes” or “No”, I can’t get it to work.
Code should be the same, just “Yes” or “No” instead of 0 or 1, yes?
$(function(){
$("#inc_tc_cov").change(function () {
var val = $(this).val();
switch(parseInt(val)){
case "Yes":
$("#HIDEIFNO").show();
break;
case "No":
$("#HIDEIFNO").hide();
break;
default:
$("#HIDEIFNO").hide();
}
});
});
Case matches the radio button values.
Tried single quotes as well.
What does this poor idiot have wrong?