How to use jQuery noConflict mode in WordPress

0

We are going to discuss how to properly use jQuery noConflict mode in WordPress. Because many times we face or jQuery not found or undefined issue in WordPress. So, Today we are going to learn how to write properly the jQuery code in WordPress.

How to use jQuery noConflict mode in WordPress

So whenever you need to write the jQuery code in WordPress then you should follow the jQuery noConflict syntax. Just follow the below syntax for writing jQuery code properly.

(function($){

  $(document).ready(function(){
    // write code here
  });

  // or also you can write jquery code like this

  jQuery(document).ready(function(){
    // write code here
  });

})(jQuery);

Now, you can write the jQuery code using $ and jQuery without getting the undefined or not defined error on the console.

I hope this article useful for you. Still, If you face any issue related to jQuery on WordPress. Please let us know by comment.

Share.

Leave A Reply

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