Title: Uncaught ReferenceError: jQuery is not defined
Last modified: March 4, 2022

---

# Uncaught ReferenceError: jQuery is not defined

 *  Resolved [Idel](https://wordpress.org/support/users/freetanga/)
 * (@freetanga)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-jquery-is-not-defined-34/)
 * Hi there! I’m usign this code…
 *     ```
       add_action( 'wp_head', function () { ?>
       <script>
       jQuery(document).ready(function() {
       	// xxxxxx
       });
       </script>
       <?php } );
   
       add_action( 'wp_enqueue_script', function () {
       	wp_enqueue_script( 'jquery' );
       } );
       ```
   
 * posted here…
 * [https://wordpress.org/support/topic/add-jquery-possible/](https://wordpress.org/support/topic/add-jquery-possible/)
 * but I get this console error:
 * Uncaught ReferenceError: jQuery is not defined
 * How can I solve it? I just want to use a very simple jQuery function.
 * Thank you! 🙂

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

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-jquery-is-not-defined-34/#post-15448249)
 * If you want to wait to exclude your script after the page is ready, you can always
   just print it in the footer:
 *     ```
       add_action( 'wp_footer', function () { ?>
       <script>
       jQuery(document).ready(function() {
       	// xxxxxx
       });
       </script>
       <?php }, 15 );
       ```
   
 *  Thread Starter [Idel](https://wordpress.org/support/users/freetanga/)
 * (@freetanga)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-jquery-is-not-defined-34/#post-15450008)
 * Same error 🙁
 * Uncaught ReferenceError: jQuery is not defined
 * Any idea why this can be happening?
 * The website uses Elementor as Page Builder and all plugins, theme and WP are 
   up to date.
 * Here is a screenshot of the snippet applied:
 * > [View post on imgur.com](https://imgur.com/3lptahi)
 * Thanks again 🙂
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-jquery-is-not-defined-34/#post-15543979)
 * You still need to include the code to enqueue jQuery:
 *     ```
       add_action( 'wp_enqueue_scripts', function () {
       	wp_enqueue_script( 'jquery' );
       } );
       ```
   
 * In fact, it looks like this might have been the problem with your original snippet:
   the hook is called `wp_enqueue_scripts`, not `wp_enqueue_script`.

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

The topic ‘Uncaught ReferenceError: jQuery is not defined’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

## Tags

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

 * 3 replies
 * 2 participants
 * Last reply from: [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-jquery-is-not-defined-34/#post-15543979)
 * Status: resolved