I've tried several ways of deselecting all elements in a radio button field, none of them have worked. I've read so many stackoverflow posts, and so much documentation. I must be so close, but I cannot figure out what I'm doing wrong
My goal is to clear the input field (this happens when a user clicks submit on the form). I can get text fields to clear, but the radio button selection just won't go away.
#addBudgetElement
h2#addBudgetElementHeader Add to your budget
fieldset
input#inputBudgetElementName(type='text', placeholder="Title")
br
input#inputAmount(type='text', placeholder='Amount')
br
input(type="radio", name="frequency", value="Once")
| Once
input(type="radio", name="frequency", value="Daily")
| Daily
input(type="radio", name="frequency", value="Weekly")
| Weekly
input(type="radio", name="frequency", value="Monthly")
| Monthly
input(type="radio", name="frequency", value="Annually")
| Anually
br
button(id='btnBudgetElementAction', data-action='add') Add To Budget
button#btnCancelUpdate.hidden Cancel
I tried doing:
$('#addBudgetElement fieldset input:radio[name="frequency"]').prop('checked', false);
and
$('#addBudgetElement fieldset input:radio[name="frequency"]').prop('checked', false).checkboxradio("refresh");
and
$("#addBudgetElement fieldset input:radio[name='frequency']").each(function(i) {
this.checked = false;
});
and
$("#addBudgetElement fieldset input:radio:checked").removeAttr("checked");
Could anyone tell me what I'm doing wrong?