Skip to main content
Nintex Community Menu Bar

Resetting Radio Button - JQuery Help

  • Mar 28, 2018 2:45 AM UTC
  • 4 replies
  • 192 views
  • Translate All

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
  • Mar 28, 2018 7:23 AM UTC

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

Translate

Forum|alt.badge.img+9
  • Author
  • Mar 29, 2018 12:31 AM UTC

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;

});

Translate

MegaJerk
Forum|alt.badge.img+14
  • Scholar
  • Mar 29, 2018 2:19 PM UTC

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)‍‍
Translate

Forum|alt.badge.img+9
  • Author
  • Apr 3, 2018 3:13 AM UTC

Thank you, that worked brilliantly.

Translate