Duplication of Radio buttons and Checkboxes

Duplication of Radio buttons and Checkboxes

Hi,

In my code, I am using a radio buttons and checkboxes, and have a Reset functionality, which uses the below code.

$("input[type='radio']").prop("checked",false).checkboxradio("refresh");

(Just one line of code is mentioned above for example, similar is been done for Check Boxes and also for checked,"true"  conditions also...)

The page has a URL that opens up a help content on top of the page(hiding the existing page). On the Help page opened we have a Back button which removes this Help page and shows back the main page with the Radio buttons and Checkboxes.
Note : As we have to retain the selection of the user we are not actually redirecting/reloading the pages.

Now if I use the Reset button it gives an error stating "'Refresh' cannot be used without Initialization".
So I used,

$("input[type='radio']").prop("checked",false).checkboxradio().checkboxradio("refresh");

This is resulting in duplicate radio buttons added to the page. A new div <div class="ui-radio"> is wrapping the previous div i.e. the hierarchy is becoming as :

<div class="ui-radio">
      <div class="ui-radio">
// The contents
      </div>
</div>

The User selection has to be retained even after the user navigates back from the Help link. The radio buttons and check boxes are added based on conditions from the jsp hence I do not have a particular set of ids or names to manipulate too.

Any help would be highly appreciated.