title: jquery .attr('onclick' does not work in IE7
body: <p>I know, there are several posts with nearly the same question, but all the mentioned "fixes" dont work for me.</p>
  
  <p>but first, here is what I need:
  Some forms in my application have to be enabled by activating an edit mode. If the edit mode is active every button (except save and abort) and link on the page should not do what it normaly does, but it should give a message that you have to end the edit mode instead.</p>
  
  <p>My script:
  The button to start the edit mode calls this:</p>
  
  <pre><code>    function startEditMode(selector) {
              var disableAction = "return false;";
              jQuery("mySelectors").each(function(){
                      jQuery(this).bind('click', editModeOnClickHandler);
                      var onClickValue = "";
                      var onClick = jQuery(this).attr("onClick");
                      if ( onClick !== undefined ) onClickValue = "" + onClick;
                      jQuery(this).attr("onClick", disableAction + onClickValue);
              });
      }
  </code></pre>
  
  <p>To stop edit mode a method exists which reverses all of this.
  The used handler "editModeOnClickHandler" just shows the message and returns false; and is not important to my question.</p>
  
  <p>So.. everything works fine in FF and IE8 (also in Chrome) but it does not in IE7. The onClick is simply not modified in IE7 via .attr as I read in other postings.</p>
  
  <p>the solution which is posted everywhere:
  Use event binding instead of manipulating attributes. I wish I can use that!</p>
  
  <p>Here is the reason why I cant:
  I tried to unbind all handlers and bind my own handler as you see in code above. But this does not prevent the inline onclick from being called. 
  Okay you might think, dont use inline calls.. but my project is written in JSF using Primefaces and most of its code is generated dynamically. All in all I do not have the possibility to prevent inline onclicks.</p>
  
  <p>Now I am stuck. 
  I have to handle with inline onclicks which can only be prevented to be called by inserting a "return false;" in front, but this seems not to be possible with IE7.</p>
  
  <p>Does anyone know a IE7 workaround to be able to manipulate the onclick attributes? And again: I can not use .bind('click'... or .click( because they are not able to stop the original inline onclick.</p>
  
  <p>Thanks for all answers!
  Alex</p>
  
  <p><strong>edit</strong>
  with your help I figured out, that in IE7 changing the inline onclick is possibile with <code>this.onclick = ..</code>. The correct handling of this was alreads answered in this question: <a href="https://stackoverflow.com/questions/249074/how-to-change-onclick-handler-dynamically">How to change onClick handler dynamically?</a> </p>
  
  <p>For my concrete problem here I found no proper solution, because I was not able to manipulate the original inline onclick values without destoying them. For that reason I changed my script, so IE7 disables all buttons and links to make sure they are no longer clickable. To be sure, not to enable too much, ill add a classname too.</p>
  
  <p>disabling all not yet disabled (its called in a loop):</p>
  
  <pre><code>if (!jQuery(this).attr('disabled')) {
      jQuery(this).attr('disabled', 'disabled');
      jQuery(this).addClass('editmodedisabled');
  }
  </code></pre>
  
  <p>enable my previous disabled things:</p>
  
  <pre><code>if (jQuery(this).hasClass('editmodedisabled')) {
      jQuery(this).attr('disabled', '');
      jQuery(this).removeClass('editmodedisabled');
  }
  </code></pre>
  
  <p>maybe this helps anyone else</p>