Firefox ReferenceError: jQuery is not defined

I am using wordpress for my site, and its running file on all browsers expect FireFox.

In firefox my site load half without styles and js files, just html version with these errors in console.

Read More
ReferenceError: jQuery is not defined www.domain.com:591

ReferenceError: jQuery is not defined www.domain.com:853

ReferenceError: jQuery is not defined www.domain.com:1262

ReferenceError: jQuery is not defined www.domain.com:1443

ReferenceError: jQuery is not defined www.domain.com:1665

ReferenceError: $ is not defined www.domain.com:1786

ReferenceError: $ is not defined www.domain.com:1795

ReferenceError: $ is not defined

But I included jQuery in my head:

<script src="/jquery-1.10.1.min.js"></script>
<script src="/jquery-ui-1.10.3.custom.js"></script>

But still its not working in firefox.

Any idea why its behaving like this in firefox?

Related posts

Leave a Reply

2 comments

  1. You shouldn’t be adding scripts to your head. Use wp_enqueue_script instead http://codex.wordpress.org/Function_Reference/wp_enqueue_script

    In the example below I load jQuery and jQuery UI core. Loading jQuery UI core will load jQuery anyway but it’s a good practise to specify it first.

    There are more jQuery UI components so choose which you need from here:
    http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Default_Scripts_Included_and_Registered_by_WordPress

    function wpse_load_js() {
        wp_enqueue_script( 'jquery' );
        wp_enqueue_script( 'jquery-ui-core' );
    }
    add_action( 'wp_enqueue_scripts', 'wpse_load_js' );
    
  2. You need to follow different way to enqueue JS in WordPress

    step 1 – While enqueue script you have 2 kind of action-

    a)’wp_enqueue_scripts’ – this action will be use if you want to enqueue scripts on the front end.
    example-

                /**
                 * Proper way to enqueue scripts and styles
                 */
                function theme_name_scripts() {
                    wp_enqueue_style( 'style-name', get_stylesheet_uri() );
                    wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
                }
    
                add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
    

    b) ‘admin_enqueue_scripts’ – this action will be use if you want to enqueue scripts on admin pages.

        function load_custom_wp_admin_style() {
                wp_register_style( 'custom_wp_admin_css', get_template_directory_uri() . '/admin-style.css', false, '1.0.0' );
                wp_enqueue_style( 'custom_wp_admin_css' );
        }
        add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );
    

    step 2- After use particular action your script will be enqueue.

    To know more please check following link-
    http://codex.wordpress.org/Function_Reference/wp_enqueue_script
    https://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts