title: Uncaught Type Error on Invisible reCaptcha while Form Submit
body: <p>I'm trying to implement new invisible recaptcha by google.</p>
  
  <p>But i have required inputs and should validate the form before recaptcha execute.</p>
  
  <p>I got an error on recaptcha callback function like that:</p>
  
  <blockquote>
    <p>Uncaught TypeError: document.getElementById() submit is not a function</p>
  </blockquote>
  
  <p>So how can i submit the form after validate and recaptcha executed?</p>
  
  <p><strong>HTML</strong>:</p>
  
  <pre><code>&lt;script src="https://www.google.com/recaptcha/api.js" async defer&gt;&lt;/script&gt;
  
  &lt;form id="form" action="?" method="post"&gt;
       Name: (required) &lt;input id="field" name="field"&gt;
       &lt;div id='recaptcha' class="g-recaptcha"
            data-sitekey="6LcAmBAUAAAAAFukLQIkOIICuBBxKEdn-Gu83mcH"
            data-callback="onSubmit"
            data-size="invisible"&gt;&lt;/div&gt;
       &lt;button id='submit'&gt;submit&lt;/button&gt;
     &lt;/form&gt;
  &lt;script&gt;onload();&lt;/script&gt;
  </code></pre>
  
  <p><strong>Javascript</strong>:</p>
  
  <pre><code>function onSubmit(token) {
    alert('Thanks ' + document.getElementById('field').value + '!');
    document.getElementById('form').submit(); // This is error line
  }
  
  function validate(event) {
    event.preventDefault();
    if (!document.getElementById('field').value) {
      alert("Please enter your name.");
    } else {
      grecaptcha.execute();
    }
  }
  
  function onload() {
    var element = document.getElementById('submit');
    element.onclick = validate;
  }
  </code></pre>
  
  <p>JSFiddle: <a href="http://jsfiddle.net/dp1cLh28/6/" rel="nofollow noreferrer">http://jsfiddle.net/dp1cLh28/6/</a></p>