title: OnClick form button
body: <p>I need to add a onclick event to a submit button of a dynamicaly generated form, and the simplified version of form looks like this:</p>
  
  <pre><code>&lt;div class="form"&gt;
     &lt;form action="demo_form.php"&gt;
      &lt;input type="text" name="fname" placeholder="First name"&gt;&lt;br&gt;
      &lt;input type="text" name="lname" placeholder="Last name"&gt;&lt;br&gt;
      &lt;input type="submit" value="Submit" class="wpcf7-submit"&gt;
    &lt;/form&gt;  
  &lt;/div&gt;
  </code></pre>
  
  <p>I was wondering is this the right way to add it (i am a javascript newbie), aka is the code formated correctly
  </p>
  
  <pre><code>document.getElementsByClassName('.form .wpcf7-submit').onclick = ga('send', 'event', { eventCategory: 'Contact Form', eventAction: 'Submit', eventLabel: 'Send Contact', eventValue: 50});;
  </code></pre>