• http://www.hvce.com/governmentnon-profit-solar-elecrtic/faq/

    for some reason the jQuery library doesn’t seem to be loading in this site. If you view the source you can see that it most definitely is there but the FAQ section is supposed to be a slider and it isn’t. I also tried writing a simple bit of jQuery code (below) just to see if the site would read it at all and it wouldn’t.

    $(document).ready(function() {
        $('body').css('background', 'red');
    });

    Any thoughts? I know the library is in the <head> but why won’t it read any jQuery code that I’m writing?

    Thanks for any help in advance!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter tdevine33

    (@tdevine33)

    sorry… stupid move just made here. There are two sites for sister companies and I posted the wrong one. The ACTUAL site is

    http://www.adksolar.com/governmentnon-profit-solar-elecrtic/faq/

    Thread Starter tdevine33

    (@tdevine33)

    bump?

    Your jQuery library is loading correctly it seems. I just entered the following in Firebug’s console window:

    jQuery(document).ready(function($) {
        $('body').css('background', 'red');
    });

    And the bg turned red as expected.

    There could be many reasons why your slider is not working. You need to look up the demo code for the slider (if you have access to any) and follow it closely.

    But you can be sure now that jQuery is loading so that’s not the issue. I noticed that you have Contact Form 7 installed. You could try disabling that temporarily as that has caused JS problems in the past (in fact I disable the JS load for Contact From 7 now).

    Try adding the jquery with this code… Place the js file in root of theme folder… I just copied this code for you from my site running already perfect…

    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.js"></script>

    n yes Try that code of jquery in static html if its working… if its broken it wouldnt even work in html…

    jQuery is already loading on his page as I stated above, that’s not the problem.

    Also, you should really be adding JS libraries via the wp_enqueue_script() function. This is the recommended and ‘safe’ way to add JS files to your WordPress page(s).

    See here for more information:
    http://codex.wordpress.org/Function_Reference/wp_enqueue_script

    Thread Starter tdevine33

    (@tdevine33)

    so when you right the jquery code starting with jQuery and use the function($) it works, but not when you start with $ and just have function(). Is this because of a conflicting library perhaps?

    Thread Starter tdevine33

    (@tdevine33)

    right = write… sorry its early and I’m still starting on my tea.

    The $ alias is problematic because several libraries use it. To avoid the problem WordPress loads jQuery in “no conflict” mode. That means that the $ alias doesn’t work and you have to load jQuery like David Gwyer did, defining the $ alias in a limited scope, or use jQuery.* every time you want to call a jQuery function. That is why you are having trouble with $.

    so when you right the jquery code starting with jQuery and use the function($) it works, but not when you start with $ and just have function(). Is this because of a conflicting library perhaps?

    As specified by the link from apljdi, this is the standard way for handling jQuery in WordPress to avoid conflicts with other JS libraries (i.e. Prototype).

    The great thing about the syntax I posted above is that you can easily cut/paste 3rd party snippets of jQuery code, which are nearly always written as above (using $).

    That’s why I always use that particular syntax. 🙂

    I also am having a jquery code problem issue is with the insert / upload icon in wordpress 3.1.2

    I just upgraded a few of my WP sites and now cant add images this is on most of my WP blogs is anyone else having this problem?
    in firebug it says that the wordpress console was having trouble with jQuery saying it was undefined this is on the dashboard page
    any help is welcome as i am not an experienced coder

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘jQuery Library not loading?’ is closed to new replies.