skip to Main Content
WordPress $ Is Not A Function When Calling JQuery Function

WordPress $ is not a function when calling jQuery function

When we are writing jQuery code in WordPress many times we get  “$ is not a function” message. WordPress uses an old version of jQuery. So When we are going to user $ directly at that time we got WordPress $ is not a function. How we can resolve WordPress dollar is not a function jQuery error.

WordPress $ is not a function when calling jQuery function

When we write jQuery code directly in WordPress theme or a plugin like.

$(document).ready(function(){
    // jQuery code is in here
});

When we are writing jQuery code like above at mostly at that time we got the dollar is not a function issue on WordPress. Let’s see how we can write the proper jQuery code in WordPress theme and plugin development.

We can write the jQuery code like for resolving $ is not a function.

(function($){

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

  // or also you can write jquery code like this

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

})(jQuery);

I hope this jQuery trick is helpful for you to resolve dollar is not function issue. Still, If you face the same issue then write the comment below.

Saroj

I am a web designer and developer part-time blogger. Write something on some free time. Find my every day thought here :)

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top