Title: Function Reference/wp enqueue script
Last modified: August 20, 2016

---

# Function Reference/wp enqueue script

 *  Resolved [monikos](https://wordpress.org/support/users/monikos/)
 * (@monikos)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/function-referencewp-enqueue-script/)
 * Hello,
    I am using for first time – Function Reference/wp enqueue script. My 
   case: I have a script /jquery/. 1. In header reference:
 *     ```
       <script language="javascript" type="text/javascript" src="/wp-includes/js/jquery/jquery-1.3.2.min.js"></script>
       ```
   
 * In fact, it is tested out of WP and it is working with the current jquery in 
   WP /1.8.3/. So, theorethicaly it doesnt need this reference, but it is working
   just with reference on. **The problem is, that the other plugins stop to work,
   when i use this reference.**
 * 2. In footer, there is a call of the function:
 *     ```
       <script language="javascript" type="text/javascript">
       $(document).ready(function() {
       						 .....................
   
       						   }
       						   )
       </script>
       ```
   
 * I read the official document [http://codex.wordpress.org/Function_Reference/wp_enqueue_script](http://codex.wordpress.org/Function_Reference/wp_enqueue_script)
 * But i am doing something wrong.
    Where i need to put this code and is there guide
   with practical examle, step by step? **Or maybe there is another solution, different
   from wp enqueue script?** Thanks

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

 *  Thread Starter [monikos](https://wordpress.org/support/users/monikos/)
 * (@monikos)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/function-referencewp-enqueue-script/#post-3604491)
 * This is the key of the solution:
    jQuery noConflict Wrappers The jQuery library
   included with WordPress is set to the noConflict() mode (see wp-includes/js/jquery/
   jquery.js). This is to prevent compatibility problems with other JavaScript libraries
   that WordPress can link.
 * In the noConflict() mode, the global $ shortcut for jQuery is not available, 
   so you can still use:
 * jQuery(document).ready(function(){
    jQuery(#somefunction) … }); but the following
   will either throw an error, or use the $ shortcut as assigned by other library.
 * $(document).ready(function(){
    $(#somefunction) … }); However, if you really 
   like the short $ instead of jQuery, you can use the following wrapper around 
   your code:
 * 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;
 *  [Ken Lewis](https://wordpress.org/support/users/trinity13/)
 * (@trinity13)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/function-referencewp-enqueue-script/#post-3604492)
 * In your theme you should tell WP that you need jQuery by using the following 
   code (don’t add the <script> tag in your header):
 *     ```
       <?php
       function my_scripts_method() {
           wp_enqueue_script( 'jquery' );
       }
   
       add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
       ?>
       ```
   
 * For the script that is to use jQuery do the following:
 *     ```
       <script language="javascript" type="text/javascript">
       jQuery(document).ready(function($) {
   
       });
       </script>
       ```
   
 * In WordPress you have to call jQuery by name. The (4) allows you to use the $
   shortcut within the confines of this call.

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

The topic ‘Function Reference/wp enqueue script’ is closed to new replies.

## Tags

 * [wp-enqueue-script](https://wordpress.org/support/topic-tag/wp-enqueue-script/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Ken Lewis](https://wordpress.org/support/users/trinity13/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/function-referencewp-enqueue-script/#post-3604492)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
