WordPress jQuery is Not Defined or undefined

0

Many times we get the jQuery is not defined error in WordPress. We got this error because the jQuery is a conflict with other plugins or theme. We face the jQuery is not defined error in some WP theme or plugin. The same code is working with some WordPress site. So, Let’s see how we can write the jQuery code on WordPress.

WordPress jQuery is Not Defined

Whenever you need to written jQuery code in WordPress. You must follow the jQuery noConflict syntax. If you write your code using jQuery noConflict syntax. Then you never get the jQuery is not defined or $ is not defined error. Your jQuery code is working fine on every WordPress sites.

Write the jQuery code with WordPress jQuery noConflict syntax.

(function($){
 
    $(document).ready(function(){
        // write code here
    });
 
    // or also you can write jquery code like this
 
    jQuery(document).ready(function(){
        // write code here
    });
 
})(jQuery);

So, Write your jQuery code using the above syntax. I hope that code is useful for you.

If you face any issue after using the above code please write the comment below.

Share.

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.