Skip to main content
Nintex Community Menu Bar

Resetting Radio Button - JQuery Help

  • March 28, 2018
  • 4 replies
  • 179 views

Forum|alt.badge.img+9

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;

4 replies

Forum|alt.badge.img+11
  • Nintex Partner
  • March 28, 2018

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);


Forum|alt.badge.img+9
  • Author
  • March 29, 2018

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;

});


MegaJerk
Forum|alt.badge.img+14
  • Scholar
  • March 29, 2018

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)

Forum|alt.badge.img+9
  • Author
  • April 3, 2018

Thank you, that worked brilliantly.