No form is submitted when captcha is solved

This is my code

<!-- Script to submit the form - execute hCaptcha -->
<script> 
      function onSubmit(token) {
        document.getElementById('digForm').submit();
      }
      function validate(event) {
        event.preventDefault();
          document.getElementById("digBut").innerHTML="Please solve the captcha.";
            document.getElementById("digBut").disabled = true;

          hcaptcha.execute();
      }
      function onload() {
        var element = document.getElementById('digBut');
        element.onclick = validate;
      }
    </script>
    enter code here

<!-- Button -->
<button class="btn btn-success h-captcha" id="digBut" data-sitekey="ExampleKey123" data-callback="onSubmit">Ready!</button>

When clicking the button the captcha appears successfully, but the innerHtml of the button and the disabled does not change, and when the captcha is solved the form is not submitted