Wordpress & jQuery: “$ is not a function”
Posted by chad on August 18th, 2009 | 16 comments
If you are trying to add your own jQuery code to Wordpress, and have had the error “$ is not a function” show up on Firebug, here is the fix:
Convert all dollar signs ($) to ‘jQuery’
The dollar sign is reserved in Wordpress for the Prototype library, which is why it errors out. For example, instead of:
$().ready(function() {
$("#select_me").show();
});
Change it to:
jQuery().ready(function() {
jQuery("#select_me").show();
});
Comments
Yeah, you saved my day!
Sweetness! Somethings are too easy…for some people.
Nice, this helps a lot! Thanks.
Thank you so much for posting this, because I was at my wits end!
Thanks; great reminder!
Thanks, God Bless…
[...] my wordpress theme’s (!) scripts. This turned out to be a jQuery problem, explained in a post here. Strangely enough editing the mv_embed script was not enough to fix the page, and the theme’s [...]
Thank You So Much for this!!
10x a lot!!!
wow so simple. Thanks
You should definitely consider using jQuery’s noConflict() method as another alternative.
http://docs.jquery.com/Using_jQuery_with_Other_Libraries
Rey – jQuery Team
Whew… I was bashing my head on the keyboard already. Thanks!
Thanks for this. Guess what? It works for Plone too!
Thank you, most helpful!
Wow, thanks.
That’s why,.
Ty so much