diff --git a/js/formidable.js b/js/formidable.js index 2d3f49cb6e..a91863aecb 100644 --- a/js/formidable.js +++ b/js/formidable.js @@ -1860,8 +1860,16 @@ function frmCaptcha( captchaSelector ) { const cl = captchas.length; for ( c = 0; c < cl; c++ ) { const closestForm = captchas[c].closest( 'form' ); - const formIsVisible = closestForm && closestForm.offsetParent !== null; - if ( ! formIsVisible ) { + if ( ! closestForm ) { + continue; + } + let shouldRenderCaptcha; + if ( closestForm.closest( '[id^=frm-modal-]' ) ) { // Form is in a modal. + shouldRenderCaptcha = true; + } else { + shouldRenderCaptcha = closestForm.offsetParent !== null; // Form is visible if offsetParent is not null. + } + if ( ! shouldRenderCaptcha ) { continue; } frmFrontForm.renderCaptcha( captchas[c], captchaSelector );