var initRec;
function initRecaptcha(modal) {
var captcha = modal.find(".g-recaptcha");
initRec = grecaptcha.render(captcha.attr("id"), {
"sitekey" : "6LekN5cUAAAAAK8F0b2qro4u4UoFiHwW9cXeHkE2",
"callback" : function(token) {
captcha.parent().find(".g-recaptcha-response").val(token);
captcha.parent().submit();
}
});
}
$('.usluga1_btn').click(function() {
$('.usluga1_popup').bPopup({
closeClass: 'close',
follow: [isFollow, isFollow],
onOpen: function() {
$('#captcha1').before('<div id="recaptcha1" class="g-recaptcha" data-callback="onSubmit" data-size="invisible"></div>');
initRecaptcha($(this));
},
onClose: function() {
$('#recaptcha1').remove()
grecaptcha.reset(initRec);
}
});
});
<div class="submit">
<input id="submit-btn" type="submit" class="button" value="Отправить"disabled>
<div class="submit-after"></div>
</div>
.submit-after {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
cursor: pointer;
}
jQuery(".submit-after").click(function(evt) {
if(jQuery(this).prev("input[disabled]").prop("disabled")) {
alert("disabled");
jQuery(this).hide();
}
});