Answer the question
In order to leave comments, you need to log in
How to download js from another site on click?
Hello! Is it possible to make google recaptcha load on click of a button?
Same as inserting into html:
<script src="https://www.google.com/recaptcha/api.js?onload=reCaptchaCallback&render=explicit" async defer></script>
Answer the question
In order to leave comments, you need to log in
$('#MYBTN').on('click',function(){
var captchaContainer = null;
var loadCaptcha = function() {
captchaContainer = grecaptcha.render('captcha_container', {
'sitekey' : 'Your sitekey',
'callback' : function(response) {
console.log(response);
}
});
};
loadCaptcha();
});
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<div id="captcha_container"></div>
<input type="button" id="MYBTN" value="MYBTN">
<script src="https://www.google.com/recaptcha/api.js?onload=loadCaptcha&render=explicit"></script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question