Easiest way to use clear link to hide html entities

Easiest way to use clear link to hide html entities

Hi everyone,

I have a large set of input fields (of checkboxes and radio buttons), and aside each set, is a clear button (just looks like text you can click on) that clears any input next to each of the input fields. When no input buttons are selected, the HTML entities that depend on them are supposed to disappear, and this works on load.

My question is how does one easily incorporate that clear button so that it tells the listeners already in action to clear those entities when they click on clear, and without having to manually do it over again with the clear button, if that makes any sense.

For example,
  1. var anySelected = ($('[name="'+obj.name+'"]:radio:checked').length > 0);
                if (anySelected) {
                    $('#Participant, #_RecruitThisPop').show();
                }
                else $('#Participant, #_RecruitThisPop, #_RecruitThisPopText, #_BeginRecruitmentDate, #_PotentialParticipantsContacted, #_ParticipantsExpected, #_RecruitmentProcedure, #_RecruitmentMaterialDocsBool, #_RecruitmentMaterialDocsText').hide();
                $('[name="'+obj.name+'"]:radio').click(function () {




  2. ... repeats from above for click action
Is already implemented, and I just want that clear button to tell this particular listener, for example, to hide all those entities I have listed. But of course, the challenge is that there are multiple clear buttons, and each one next to a set of IDs that hide different entities.

Each clear button has a class, but no IDs to distinguish one from the other. They do have a form name and an inline JS call to clear the form fields, but that's it. Looks like:

  1. onclick = clearRadioButtons(0, '_PR_Populations.customAttributes._CoercionSituation'); return false

Thanks,

Eggers