• Resolved Will Stocks

    (@willstockstech)


    Hi guys,

    I don’t know if this actually affecting anything or not, but I’m seeing a console error being logged every time I visit my contact form page (https://willstocks.co.uk/contact):

    Uncaught ReferenceError: jQuery is not defined
    at contact:formatted:1944
    (anonymous) @ contact:formatted:1944

    Relating specifically to:

        (function($) {
            $('.wpcf7').on('wpcf7:spam', function(e) {
                $('[name="g-recaptcha-response"]', $(this)).each(function() {
                    if ('' === $(this).val()) {
                        var $recaptcha = $(this).closest('.wpcf7-form-control-wrap');
                        wpcf7.notValidTip($recaptcha, wpcf7iqfix.recaptcha_empty);
                    }
                });
            });
        }
        )(jQuery);

    I assume it is throwing this error because jQuery has not fully loaded yet?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Will Stocks

    (@willstockstech)

    Out of curiosity… could this not be converted to a vanilla js snippet, rather than relying on jquery?

    Plugin Author IQComputing

    (@iqcomputing)

    Hello,

    Thank you for bringing this to our attention. It’s something we’re aware of and we are looking to convert this to vanilla JavaScript. This is an artifact from Contact Form 7 v5 which was pulled over in the diff. We believe it has something to do with deferred JavaScript ( jQuery at the top ). Whenever it hits the inline JavaScript it hasn’t quite loaded the jQuery yet, throws a console error but proceed to function correctly once the deferred script has actually loaded.

    If you are not having issues we will mark this thread as resolved for now but will reply here once we release an update with the snippet converted to vanilla JavaScript. Have a wonderful rest of your week!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘jQuery console error being logged’ is closed to new replies.