Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: ReCAPTCHA placeholder element must be an element or id  (Read 12419 times)

0 Members and 1 Guest are viewing this topic.

toplisek

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Unknown
    ReCAPTCHA placeholder element must be an element or id
    « on: February 16, 2018, 04:48:59 AM »
    I have two errors with an error message:
    Uncaught Error: ReCAPTCHA placeholder element must be an element or id

    How to solve these errors?
    Need help.
    Code: [Select]
    <!DOCTYPE HTML>

    <html>

    <head>
      <title>reCaptcha</title>
    </head>

    <body>
    <form id="MytblID" class="MytblID" action="" method="post">

    <div class="g-recaptcha MYXXX-recaptcha" data-sitekey="XXX" data-expired-callback="recaptchaExpired"></div>
    <script src="https://www.google.com/recaptcha/api.js?hl=en-GB&onload=Callback&render=explicit" async defer></script>

    <script>
    var form = "#MytblID";
    var Callback = function () {
      var onRecaptchaExpired = function () {
        alert("Warning message as recatpcha has expired!");
        // grecaptcha.reset();
      };
      var gRecaptchaInput = jQuery('.MYXXX-recaptcha');

      gRecaptchaInput.each(function (key)
        {
          var $this = jQuery(this);
          var siteKey = $this.data('sitekey');
          $this.html('');
          grecaptcha.render(document.getElementById($this.attr('id')),
            {
            'sitekey': 'XXX',
            'expired-callback': onRecaptchaExpired
            }
          );
        }
      );
    };
    </script>
    </form>
    </body>

    </html>
    « Last Edit: February 16, 2018, 05:01:46 AM by toplisek »

    al3c



      Newbie

      • Experience: Beginner
      • OS: Unknown
      Re: ReCAPTCHA placeholder element must be an element or id
      « Reply #1 on: June 11, 2018, 12:35:40 AM »
      I solved it by adding render="explicit" and onloadCallback={console.log.bind(this, "recaptcha loaded")}
      calculus hw done is easy for me

      __\_____/__
           __   __
              ___