I am facing an issue with adding reCaptcha to 2 tabs within a component. The code I implemented only displays the captcha in the first tab.
<div class="tab-content clearfix">
<div class="tab-pane active" id="1a">
<form>
<div class="g-recaptcha" id="recaptchaTab1" :data-sitekey="rcapt_sig_key"></div>
</form>
</div>
</div>
<div class="tab-content clearfix">
<div class="tab-pane active" id="1a">
<form>
<div class="g-recaptcha" id="recaptchaTab2" :data-sitekey="rcapt_sig_key"></div>
</form>
</div>
</div>
In javascript
data() {
return {
rcapt_sig_key: "site_key",
recaptchaTab2: 0,
recaptchaTab1: 0
}
},
mounted() {
if (window.grecaptcha) {
this.rcaptIdTab2 = grecaptcha.render( 'recaptchaTab2', { sitekey : this.rcapt_sig_key });
this.rcaptIdTab1 = grecaptcha.render( 'recaptchaTab1', { sitekey : this.rcapt_sig_key });
}
}
Upon refreshing the page, the captcha is still only displayed in the first tab.