PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. 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 in called in header

  1. I have the jQuery library called from Google earlier in my pages, then there's another version added that conflicts with other elements on the page.

    I went through the code, but couldn't find where it was being called. I really didn't think that it was part of your code except that it only shows up if there is a Gravity form on that page.

    For sake of being thorough:

    This is what I am calling above wp_head:
    <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>

    This is what shows up on both of my Gravity Form pages (and no others) as a result of the wp_head call:

    <script type='text/javascript' src='http://DOMAIN/wp-includes/js/jquery/jquery.js?ver=1.3.2'></script>
    <script type='text/javascript' src='http://DOMAIN/wp-content/plugins/gravityforms/js/conditional_logic.js?ver=1.3.10'></script>
    Posted 14 years ago on Wednesday March 10, 2010 | Permalink
  2. Gravity Forms enqueues the WordPress built in jQuery and relies on it to function. That is why it is only appearing on pages where a Gravity Form is present. I'm not sure if there is a solution to this right now short of editing the gravityforms plugin files to remove the enqueue call which calls in jquery.

    Posted 14 years ago on Wednesday March 10, 2010 | Permalink
  3. You can always use the built in wp_enqueue_script functionality to call jQuery rather than manually trying to include it. That way, there shouldn't be conflicts or problems with jQuery being called twice.

    http://digwp.com/2009/06/including-jquery-in-wordpress-the-right-way/

    Posted 14 years ago on Wednesday March 10, 2010 | Permalink
  4. Carl,

    Can I remove the Gravity function that enques it if needed via my functions.php? jQuery is loaded on every page by default.

    Think you could fill in the blanks for me here?

    remove_action()

    Posted 14 years ago on Wednesday March 10, 2010 | Permalink
  5. There isn't currently a filter for this that I am aware of, but I will look at it.

    Any reason you calling jQuery from Google instead of using WordPress built in jQuery?

    You could run into this same issue with other plugins that automatically enqueue jQuery as enqueue only works with scripts called via enqueueue... it can't tell that jQuery is already included if it's called externally.

    Posted 14 years ago on Thursday March 11, 2010 | Permalink
  6. It looks like you're also loading the same version of jQuery that's packaged with WordPress so again, no real reason not to use the wp_enqueue_script method. It seems like you're going to end up making more work for yourself trying to go around the built in method.

    Posted 14 years ago on Thursday March 11, 2010 | Permalink
  7. Actually using the Google version is purely for speed purposes. It cuts down on the number or requests to a single server (which are limited by default on all browsers). Requesting it from goog does two things - one it's likely already been loaded prior to the visitor arriving so it won't be loaded again; two, as mentioned, its request isn't restricted by concurrent connection limitations of the browser.

    Basically, it's just good practice to keep the load times down. There are plenty of articles on this at the various design/dev blogs.

    Kevin, you'll notice in the link you gave me there is also WordPress plugin available to modify the enqueue jQuery to request the goog version. That was the easiest and most light weight to implement in my case.

    Ultimately my solution to this was pretty simple. I enabled that plugin and moved all of my calls below the wp_head. I guess I was just being stubborn and wanted it to load a specific way in the header. Problem solved.

    Really can't thank you guys enough. Excellent plugin.

    Personal twitter: @tenaciousJk

    Posted 14 years ago on Friday March 12, 2010 | Permalink
  8. Cool. I totally missed the plugin link too. I'll have to check it out. Thanks.

    Posted 14 years ago on Friday March 12, 2010 | Permalink

This topic has been resolved and has been closed to new replies.