wordpress - TypeError: $ is not a function when calling jQuery function -
i have simple jquery script in wordpress plugin using jquery wrapper this:
$(document).ready(function(){ // jquery code in here }); i calling script within wordpress dashboard , loading after jquery framework has loaded.
when check page in firebug keep receiving error message:
typeerror: $ not function
$(document).ready(function(){
should maybe wrap script in function:
(function($){ // jquery code in here })(jquery); i have had error quite few times , not sure how handle it.
any appreciated.
by default when enqueue jquery in wordpress must use jquery, , $ not used (this compatibility other libraries).
your solution of wrapping in function work fine, or can load jquery other way (but that's not idea in wordpress).
if must use document.ready, can pass $ function call:
jquery(function ($) { ...
Comments
Post a Comment