Title: local jQuery not working?
Last modified: August 22, 2016

---

# local jQuery not working?

 *  [comicBookGuy](https://wordpress.org/support/users/comicbookguy/)
 * (@comicbookguy)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/local-jquery-not-working/)
 * Looked around for a bit and could not find an answer. Maybe I’m using bad keywords.
 * I have installed wordpress and have the default Twenty Fifteen theme activated.
 * This is a new install and I have changed nothing to the files.
 * When I check the Sources tab in Chrome Developers tool, it shows jQuery is being
   loaded from:
    wp-includes/js/jquery/jquery.js?ver=1.11.1
 * If I check the page source I can clearly see in the head jquery is being loaded.
 *     ```
       <script type='text/javascript' src='http://yourdomain.com/wp-includes/js/jquery/jquery.js?ver=1.11.1'></script>
       <script type='text/javascript' src='http://yourdomain.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>
       ```
   
 * So to test whether or not jQuery commands are working or not I put a:
 *     ```
       <script>
       $( document ).ready(function() {
       	alert("hello");
       });
       </script>
       ```
   
 * At the end of the footer.php file.
 * And it does NOT work. If i strip out the jquery $( document ).ready(function(){…});
   stuff then the alert pops up.
 * If i include jQuery via CDN in the head section (header.php), then the jquery`
   $( document ).ready(function() { ... });` does work.
    `<script src="https://ajax.
   googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>` (I know you 
   have to use enque and register in fucntions.php to properly load JS)
 * So my question is what is the wp-includes/js/jquery/jquery.js?ver=1.11.1 file
   all about? Why is it being loaded if it doesn’t even execute basic jquery?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [dev_danidhariya](https://wordpress.org/support/users/dev_danidhariya/)
 * (@dev_danidhariya)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/local-jquery-not-working/#post-5896877)
 * Dear comicBookGuy .
    At the end of the footer.php file no script,session,global
   data not working. So,You Add js File in ur theme function.php file like this **
   function.php**
 *     ```
       function add_stayle(){
       wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
       }
       add_action( 'wp_enqueue_scripts','add_stayle');
       ```
   
 * **Note:**
    example.js is ur js file name.
 * Thank’s
    Dev
 * Enjoy..!!
 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [11 years, 2 months ago](https://wordpress.org/support/topic/local-jquery-not-working/#post-5896878)
 * The reason is because jQuery in WordPress is set to `noConflict()`
 * You can read about it here: [http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_Wrappers](http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_Wrappers)
 * So this will work:
 *     ```
       jQuery( document ).ready( function( $ ) {
           // Can use $ for jQuery
           var el = $( '.class' );
       } );
       ```
   
 * Alternatively you can use:
 *     ```
       ( function( $ ){
           var el = $( '#elementid' );
       } )( jQuery );
       ```
   
 *  Thread Starter [comicBookGuy](https://wordpress.org/support/users/comicbookguy/)
 * (@comicbookguy)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/local-jquery-not-working/#post-5896953)
 * ty Jose.
 * for future reference this is what I found from the suggested reading:
 * jQuery(document).ready(function($) {
    // Inside of this function, $() will work
   as an alias for jQuery() // and other libraries also using $ will not be accessible
   under this shortcut });
 * That wrapper will cause your code to be executed when the DOM is fully constructed.
   If, for some reason, you want your code to execute immediately instead of waiting
   for the DOM ready event, then you can use this wrapper method instead:
 * (function($) {
    // Inside of this function, $() will work as an alias for jQuery()//
   and other libraries also using $ will not be accessible under this shortcut })(
   jQuery);
 * Alternatively, you can always reasign jQuery to another shortcut of your choice
   and leave the $ shorcut to other libraries:
 * var $j = jQuery;

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘local jQuery not working?’ is closed to new replies.

## Tags

 * [jquery](https://wordpress.org/support/topic-tag/jquery/)
 * [problem](https://wordpress.org/support/topic-tag/problem/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [comicBookGuy](https://wordpress.org/support/users/comicbookguy/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/local-jquery-not-working/#post-5896953)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
