TypeError: $ is not a function when calling jQuery function

后端 未结 16 2152
慢半拍i
慢半拍i 2020-11-22 02:42

I have a simple jQuery script in a WordPress plugin that is using a jQuery wrapper like this:

$(document).ready(function(){

    // jQuery code is in here

}         


        
16条回答
  •  佛祖请我去吃肉
    2020-11-22 03:11

    You can avoid confliction like this

    var jq=jQuery.noConflict();
    jq(document).ready(function(){  
      alert("Hi this will not conflict now");
      jq('selector').show();
    });
    

提交回复
热议问题