【问题标题】:How does the google reCAPTCHA data-callback event workgoogle reCAPTCHA 数据回调事件如何工作
【发布时间】:2018-08-05 09:01:09
【问题描述】:

这可能是一个愚蠢的问题,所以很抱歉我是网络开发的新手。我正在尝试编写一个页面,以便在单击 reCAPTCHA 之前禁用搜索按钮(我知道这可以被垃圾邮件发送者规避,所以这不是我关心的问题)。我目前的设置方式是这样的:

<div id="search_area">
    <script type="text/javascript">
        function enableButton() {
            document.getElementById('search_submit').disabled = false;
        }
    </script>
    <input id="ch_search" size="50" type="text"/><button class="search_button" id="ch_search_submit" disabled="true">Search</button>
    <script src='https://www.google.com/recaptcha/api.js'></script>
    <div class="g-recaptcha" data-sitekey="XXXXXXXXXX" data-callback = "enableButton()" ></div>
</div>

目前仅用于初始测试,我没有 php 验证检查表单。当我检查文本框并变为绿色时,它没有像我想象的那样启用搜索按钮。谁能指出我为什么这不起作用的正确方向?感谢您对成为新手的任何帮助。

【问题讨论】:

    标签: javascript html recaptcha captcha


    【解决方案1】:

    我意识到我的问题是我正在调用 enableButton() 并且它需要是不带括号的 enableButton。

    【讨论】:

      猜你喜欢
      • 2017-10-08
      • 2020-12-12
      • 1970-01-01
      • 2015-03-12
      • 2015-12-28
      • 2017-07-20
      • 1970-01-01
      • 2017-04-22
      • 1970-01-01
      相关资源
      最近更新 更多