0

Can anyone tell why my jQuery script is not loading here

<?php wp_enqueue_script("jquery"); ?>

<?php wp_head(); ?>

<script src="http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/slides.jquery.js"></script>
<script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/my-js-file.js"></script>

        <script>
        $(document).ready(function() {
                        $('#slides').slides({
                                preload: true,
                                preloadImage: 'img/loading.gif',
                                play: 5000,
                                pause: 2500,
                                hoverPause: true
                        });
                });
        </script>

</head>
3
  • cause <script> requires type="text/javascript" ? Commented Jun 13, 2012 at 10:58
  • 1
    Can you post the generated html or even better a link to the page? The specific error message you get would also help. Commented Jun 13, 2012 at 11:06
  • Check your included script path and also replace $ with jquey. Also provide error message and generated html if possible. Commented Jun 13, 2012 at 11:28

2 Answers 2

1
<?php
function my_scripts_method() {
    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_method');
?>

Or simply use the latest version from jquery.com

<script src="http://code.jquery.com/jquery-latest.min.js"></script>

Good luck! :)

Sign up to request clarification or add additional context in comments.

Comments

0

Not sure if the double quotes are what's causing the problem, it's a good idea to enqueue scripts for the front end via functions.php and not in header.php. Like so;

if ( !is_admin() ) {
wp_enqueue_script('jquery');
}

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.