cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Resetting Radio Button - JQuery Help

Jump to solution

I'm resetting a set of two radio buttons anytime a dropdown value changes. The following works, but how can I combine the two lines into one?

NWF$("#" + DDL).find("input[value='No']")[0].checked=false;
NWF$("#" + DDL).find("input[value='Yes']")[0].checked=false;

0 Kudos
Reply
4 Replies
Workflow Hero

Re: Resetting Radio Button - JQuery Help

Jump to solution

Hi Furst‌,

Have you tried: 

       NWF$("#" + DDL).attr('checked',false);

or

       NWF$("#" + DDL).find("input[name='control name']").attr('checked',false);

or

NWF$("#" + DDL).find("input[name='control name']")[0].attr('checked',false);

Reply
Workflow Hero

Re: Resetting Radio Button - JQuery Help

Jump to solution

I don't think any of that will work as my code looks like this:

var obj = NWF$("#" + DropDownList);obj.change(function() {
NWF$("#" + RadioButtonSet).find("input[value='No']")[0].checked=false;
NWF$("#" + RadioButtonSet).find("input[value='Yes']")[0].checked=false;

});

Reply
Workflow Hero

Re: Resetting Radio Button - JQuery Help

Jump to solution

If the target control with the ID stored in the javascript variable called DDL is a radio button, then we know that there will only ever be (1) option checked at any given time. 

Inside of wherever you're handling the change event for your other control, you can use the following code to reset the radio buttons no matter the state or quantity of options:

NWF$("#" + DDL).find("input:checked").prop("checked", false)
Reply
Workflow Hero

Re: Resetting Radio Button - JQuery Help

Jump to solution

Thank you, that worked brilliantly.

0 Kudos
Reply