如何解决“未捕获的错误:reCAPTCHA占位符元素必须为空”

时间:2019-11-09 16:10:05

标签: javascript recaptcha

先前曾写道“找不到函数grecaptcha.render”,试图对其进行修复

init:function(){

var el = this.element.get(0);
var self = this;
setTimeout(function() {
    if (typeof grecaptcha === 'undefined') {
        self.init();
    } else {
        self.grecaptcha = grecaptcha.render(el, {
            sitekey: self.options.key,
            callback: self.callbackResponse.bind(self)
        });
    }
}, 100);

this.input = $('<input>').attr({
    name: this.options.name,
    type: 'hidden'
});

this.input.appendTo(this.element);

var reset = $('#' + $(el).attr('id') + '-reset');

if (reset.length) {
    reset.click(this.reset.bind(this));
}

}

0 个答案:

没有答案