Please Note: We are no longer using forums to facilitate standard support. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

jQuery not defined? Empty jQuery function in wp_head();?

  1. Hey guys...I'm running into an odd JS error:

    Error: jQuery is not defined
    Source File: http://www.missouladowntown.com/add-property/
    Line: 46

    Also here:
    http://www.missouladowntown.com/contact/
    http://www.missouladowntown.com/add-member/

    But not, say, here (no GF form):
    http://www.missouladowntown.com/dine/

    This seems to be appearing on any page within our site that has an embedded GF Form....here's the rendered source code (empty function) that's triggering there firebug/JS error:

    '<script>
    jQuery(function(){
    });
    </script>'

    Any thoughts as to why this function is printing out and/or why it is empty?

    Thanks in advance.

    Posted 3 years ago on Friday January 27, 2012 | Permalink
  2. Trying to bump this up again....I've circled back here, still trying to solve this issue. Turns out that Gravity was putting this empty function in before wp_head(), where I was previously including jQuery. I've remedied that part now, but when an AJAX form (that's key...the AJAX bit, "regular" forms now no longer trip an "undefined" error) is submitted with validation errors...I still get the nagging "jQuery is undefined" error...but the form still seems to perform correctly. Scratching my head here....anyone have an idea what's going on or how to fix it?

    Try submitting one of these forms with not data entered...you'll see the errors in Firebug and should see that jQuery is present just two lines ahead of the offending tags....

    http://www.missouladowntown.com/add-property/
    http://www.missouladowntown.com/add-member/

    Posted 3 years ago on Friday March 2, 2012 | Permalink
  3. gruvii
    Member

    You are probably making calls to jQuery before it has loaded. This might be happening if you are loading jQuery and other scripts in the footer/end of the body. What you can do is queue the calls to jQuery and then execute them once jQuery is loaded. Colin has a very good script for doing so here: http://blog.colin-gourlay.com/blog/2012/02/safely-using-ready-before-including-jquery/ .

    Posted 3 years ago on Tuesday March 20, 2012 | Permalink

 

Support Tickets

Open A New Support Ticket
 Open A New Priority Support Ticket *

* Developer license holders only