I have two radio buttons, yes and no.
I want to check if any of the radio buttons are checked and if not, then default the no radio button to checked.
Here is my attempt:
if ($("#type_No").attr('checked', false) && $("#type_Yes").attr('checked', false)) {
$('#type_No').attr('checked', true);
}
However, while testing this, I realized this is incorrect because it's setting the values of the checkboxes and not checking if they're checked or not.
So, how do I check if a radio button is checked or not based on the id of the radio button?