4

我刚刚从 v2 升级,css 不再是从我的 UI 中隐藏 recaptcha 徽章的有效选项。这可以用 JavaScript 完成吗?

4

2 回答 2

4

您可以通过递归和requestAnimationFrame.

尝试创建这样的东西:

function hideRecaptcha() {
    const recaptcha = $(".grecaptcha-badge");
    if (recaptcha.length) return recaptcha.css({ display: "none" });
    requestAnimationFrame(() => this.hideRecaptcha());
}

然后hideRecaptcha()在加载 recaptcha 脚本后立即调用。

于 2018-11-01T21:29:55.867 回答
0

您应该将其设置为 visibility: none 因为如果您使用 display none 并完全删除它,它可能会破坏垃圾邮件检查。

看这里。 如何隐藏 Google Invisible reCAPTCHA 徽章

于 2021-01-03T17:56:43.607 回答