Recpatcha validation using expired value

Need help if this code can be improved using a callback.

<!DOCTYPE HTML>

<html>

<head>
<title>Recpatcha validation using expired value</title>
<script>
var form = "my_tblid";
var Callback = function () {
  var recaptchaExpired = function () {
    alert("Warning message as recatpcha has expired!");
    // grecaptcha.reset();
  };
  var gRecaptchaInput = jQuery('.pmust73rwi-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': recaptchaExpired
        }
      );
    }
  );
};
</script>
</head>

<body>
<div class="g-recaptcha pmust73rwi-recaptcha" data-sitekey="" data-theme="light" data-expired-callback="recaptchaExpired"></div>

<script src="https://www.google.com/recaptcha/api.js?hl=en-GB&onload=Callback&render=explicit" async defer></script>

</body>

</html>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.