admin管理员组

文章数量:1326282

I would like to capture a click event on Google reCAPTCHA like below.

I am using the below code.

jQuery('#I0_1444640729099').on('load', function() {
    jQuery(".recaptcha-checkbox-checkmark").click(function() {
        alert("test");
    });
});

But I cannot do that. Can anyone help me in this regard?? I would like to catch the successful captcha submission event too.

I would like to capture a click event on Google reCAPTCHA like below.

I am using the below code.

jQuery('#I0_1444640729099').on('load', function() {
    jQuery(".recaptcha-checkbox-checkmark").click(function() {
        alert("test");
    });
});

But I cannot do that. Can anyone help me in this regard?? I would like to catch the successful captcha submission event too.

Share Improve this question edited Jun 22, 2019 at 20:59 Towkir 4,0142 gold badges26 silver badges42 bronze badges asked Oct 12, 2015 at 9:23 abu abuabu abu 7,06023 gold badges82 silver badges155 bronze badges 9
  • 2 You simply should not do that..... that is the whole purpose of having a captcha – Arun P Johny Commented Oct 12, 2015 at 9:24
  • @ArunPJohny Thanks for your reply. How can I do that ?? How can I detect user click on the captcha checkbox ?? – abu abu Commented Oct 12, 2015 at 9:26
  • I'm not sure but probably you can't achieve that by a simple click call. The whole purpose of that captcha is to catch if a real user clicked it or not. So, there might be some plex extra hidden events working in the background. I'm guessing maybe it requires some mouseenter and mousemove events before clicking etc... – Noldor Commented Oct 12, 2015 at 9:29
  • I dont think so you can do this as this is the whole point of using recaptcha and other verification methods so that no one can automate a particular process, YOU SIMPLY CANNOT – user3937422 Commented Sep 13, 2018 at 17:19
  • 1 Possible duplicate of ReCaptcha v2 client side events – user3937422 Commented Sep 13, 2018 at 17:20
 |  Show 4 more ments

1 Answer 1

Reset to default 3

You can add a data-callback to the DIV that Google gives you:

<div class="g-recaptcha" data-callback="recaptchaCallback" data-sitekey="RECAPTCHA_KEY"></div>

Then you add the callbak function to your code:

$("#g-recaptcha-response").on("click", function(){
    alert("test"); });

I hope I've helped

本文标签: javascriptjQuery click event on Google reCAPTCHAStack Overflow