Support » Plugin: Contact Form 7 reCAPTCHA » Problems with the use of $ in yourt Plugin

  • Resolved sixtyseven

    (@sixtyseven)


    Hi, I recently stumbeled over an issue with your plugin. On the index.php on line 107 you used the following jQuery code:

    $('.wpcf7').on('mailsent.wpcf7',function(e){
            var id = $('.g-recaptcha-explicit-id', this).val();
            $('#' + id).html('');
            grecaptcha.render(id, {
                'sitekey' : '<?php echo $this->site_key; ?>'
            });
        });

    This produced an arreor in my modified twenty fifteen theme. You probably should wrap this function like so:

    ( function( $ ) {
    		$('.wpcf7').on('mailsent.wpcf7',function(e){
    			var id = $('.g-recaptcha-explicit-id', this).val();
    			$('#' + id).html('');
    			grecaptcha.render(id, {
    				'sitekey' : '<?php echo $this->site_key; ?>'
    			});
    		});
    	} )( jQuery );

    or just use jQuery instead of $. Hope that helps someone.

    https://wordpress.org/plugins/contact-form-7-recaptcha/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problems with the use of $ in yourt Plugin’ is closed to new replies.