Title: Integrate jQuery
Last modified: November 11, 2021

---

# Integrate jQuery

 *  [rawald](https://wordpress.org/support/users/rawald/)
 * (@rawald)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/integrate-jquery/)
 * Hi there, I’ve been trying for hours and simply can’t get this to work. My jquery
   works perfect on Codenpen but nothing on WordPress.
 * My code is:
 *     ```
       add_action( 'wp_enqueue_script', function () {
       	wp_enqueue_script( 'jquery' );
       });
   
       ?>
   
       <script>
   
       	function runFunction(){
       $.noConflict();
       jQuery(document).ready(function(){
           // Your code in here
         jQuery('#billing_test').on('change', function() {
         myFunc();
       })
       function myFunc() {
           // your function code
       var complex_name = jQuery('#billing_test').val();
   
       var suburb = jQuery('#billing_suburb').val();
   
       if (complex_name == 'mr') {
        alert('works');
   
          jQuery('#billing_postcode').val('5000');
   
   
       }
        }
       })
   
       	}
   
       </script>
   
       <?php
   
       add_action( 'wp_head', 'runFunction');
       ```
   
 * I’ve tried with both $ and jQuery, it runs perfect in CodePen using the same 
   code with corresponding HTML but does nothing on WP.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/integrate-jquery/#post-15083514)
 * Have you checked your browser console to see if there are any errors? Also, double
   check the page source that jQuery is loaded and the script is outputted correctly.

Viewing 1 replies (of 1 total)

The topic ‘Integrate jQuery’ 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/)

 * 1 reply
 * 2 participants
 * Last reply from: [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * Last activity: [4 years, 6 months ago](https://wordpress.org/support/topic/integrate-jquery/#post-15083514)
 * Status: not a support question