title: Internet Explorer 7 onclick event on submit button does not fire
body: <p>I have a form which submits via ajax to the back-end and I'm writing a general disable function in javascript that I can use to set the onclick of an element. Typing this into the browser so ignore any syntax errors in the following. </p>
  
  <pre><code>function(elementID , processingText) {
      var element = document.getElementById(elementID);
      if (element) {
          element.setAttribute("onClick", "alert('test')");
      }
  }
  </code></pre>
  
  <p>So basically the element should have an onclick event to set an alert. I can confirm that the onclick attribute is being set correctly and it fires in IE8+, Chrome and Firefox. It will not fire in IE7.</p>
  
  <p>The element I'm testing on is a submit button in a form (one form on the page). It has many fields and one submit button. </p>
  
  <p><strong>EDIT</strong> The code dispatches with an action so it should submit anyway but not until after the alert has been acknowledged <strong>/EDIT</strong></p>
  
  <p>I've trawled the net for the past two hours and the following solutions do not work or are not an option- </p>
  
  <p>Add a hidden input field to form.
  Wrap submit button in  tag and set the onclick in this tag.
  Changing case of onclick to onClick</p>
  
  <p>Any solutions which involve altering the html without using javascript are not an option, I'm trying to create a general disableElement function. I can target the script at IE7 so it does not have to work in all browsers, just IE7.</p>
  
  <p>Any help would be greatly appreciated </p>