How to change the copy of object of dom without affecting base dom?

How to change the copy of object of dom without affecting base dom?

Hi Team, 

I am creating object and setting with part of innerHTML of dom and sending it following function to make sum changes before i process it for print pdf. however whenever I am applying any change on that object it is getting effect on main dom. I am trying to remove all the href from innerHTML and it works fine but after this on main page hyperlinks stop working. 
  1.     function RemoveHyperlinks(obj) {
  2.         var innerhtmlobj;
  3.         var array = obj[0].innerHTML.split('href=\"');
  4.  
  5.         var temp;
  6.         for (i = 0; i < array.length; i++) {
  7.             if (i == 0) {
  8.                 innerhtmlobj = array[i];
  9.             }
  10.             else {
  11.                 temp = array[i].split('"')[0].length;
  12.                 if (temp == 1 && array[i].split('"')[0] == '#') {
  13.                     innerhtmlobj = innerhtmlobj + 'href=\"' + array[i];
  14.                 }
  15.                 else {
  16.                     innerhtmlobj = innerhtmlobj + 'href=\"\" ' +array[i].substring(temp + 1);
  17.                 }
  18.  
  19.             }
  20.         }
  21.         return innerhtmlobj;
  22.     }

I tried keeping one more object to hold oldinnerhtml and replacing back to mainpage innerhtml but it is loosing the buttonclick registration and not working on click.

Please let me know how to get the innerHTML and change it without affecting main page. 

Thanks & Regards,
Kamleshkumar Gujarathi.