Reset recaptcha contact form 7 [closed]

Since the recaptcha is created by contact form 7 without assigning the rendered recaptcha to a variable it was not possible to use grecaptcha.reset(opt_widget_id).
Here is what is did:

$(".wpcf7-submit").click(function(event) {
var currentForm=$(this).closest("form");
$( document ).ajaxComplete(function(event,request, settings) {
    var responseObj=JSON.parse(request.responseText);
    if(responseObj.mailSent==true){
        //reset recaptcha
        var recaptchaIFrame=currentForm.find("iframe").eq(0);
        var recaptchaIFrameSrc=recaptchaIFrame.attr("src");
        recaptchaIFrame.attr("src",recaptchaIFrameSrc);
    }
   });
});

I have cleared the iframe source and reassigned the same src so that it reloads the recaptcha once it has been submitted.

I hope this helps someone !