title: Save and restore "onclick" action on jQuery objects
body: <p>I want to disable a whole bunch of objects on the page, and then re-enable them later.  Since some of them are  tags rather than buttons, I disable them by removing their onclick attr.  I've tried to store the old handler in a .data(), but unfortunately when I attempt to restore them with <code>$(obj).attr('onclick',$(obj).data('onclick'))</code>, it calls the function rather than restoring it to the attribute.  And if I try to store it in a different attribute instead of a data, it doesn't store the function, it stores the return value for the function.</p>
  
  <p>Is there any way to accomplish this without re-writing every  tag and every onclick handler on my page?</p>
  
  <pre><code>if( doEnable) {
  
      $(obj).attr('href', $(obj).data('href'));
      $(obj).attr('onclick', $(obj).data('onclick'));
  
  
      $(obj).removeClass(EIS.config.classes.disabled);
      $(obj).show();
  
  }
  else {
      // Save the things you're going to remove
      $(obj).data('onclick', $(obj).attr('onclick'));
      $(obj).data('href', $(obj).attr('href'));
  
      $(obj).prop("href", null);
      $(obj).prop("onclick", null);
  
      $(obj).addClass(EIS.config.classes.disabled);
      $(obj).show();
     }
  </code></pre>
  
  <p>By the way, this code seems to work fine in Chrome and Firefox, but only sometimes in IE8 and never in IE6.  Unfortunately the client tests first in IE6.</p>