Quantcast
Viewing all articles
Browse latest Browse all 95984

zakkath on "Getting Google jQuery to Load"

I have looked at various tutorials and whatnot but am still having trouble getting it to load.

In my functions.php file I have:

function my_scripts() {
    wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
    wp_enqueue_script( 'jquery' );
}    

add_action('wp_enqueue_scripts', 'my_scripts');

And then in my test file I simply have the following:

if (typeof jQuery != 'undefined') {
    alert("jQuery library is loaded!");
}else{
    alert("jQuery library is not found!");
}

When I hardcode the script call into header.php, the test works fine. When I attempt to use the function above, I get the not found error and there is no script tag in the HTML header.

Am I missing something?


Viewing all articles
Browse latest Browse all 95984

Trending Articles