18 Aug 2009

Wordpress & jQuery: “$ is not a function”

jQuery 35 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();
});

35 Responses to “Wordpress & jQuery: “$ is not a function””

  1. Fabian says:

    Yeah, you saved my day!

  2. Blair says:

    Sweetness! Somethings are too easy…for some people.

  3. Matt Cassarino says:

    Nice, this helps a lot! Thanks.

  4. Natasha says:

    Thank you so much for posting this, because I was at my wits end! :)

  5. Matt says:

    Thanks; great reminder!

  6. Andy says:

    Thanks, God Bless…

  7. Mv_Embed in use for html5 videos | AHunt.org says:

    [...] 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 [...]

  8. Nick says:

    Thank You So Much for this!!

  9. Andrey says:

    10x a lot!!!

  10. worldwisewebs says:

    wow so simple. Thanks :)

  11. Rey Bango says:

    You should definitely consider using jQuery’s noConflict() method as another alternative.

    http://docs.jquery.com/Using_jQuery_with_Other_Libraries

    Rey – jQuery Team

  12. Mark says:

    Whew… I was bashing my head on the keyboard already. Thanks!

  13. Brian says:

    Thanks for this. Guess what? It works for Plone too!

  14. Justin says:

    Thank you, most helpful!

  15. droope says:

    Wow, thanks. :) That’s why,.

  16. GChatzop says:

    Ty so much

  17. prashant says:

    Hey you rock, thanks for the post

  18. Veerendra says:

    Thank you
    you saved my day !

  19. Simon Lachance says:

    Hey saved my day too, how many days did you save?

  20. ziki says:

    Thanks a lot, works as a charm :)

  21. Ryan says:

    hooooooly crap. You’re the shizznizlze.

  22. headbuster says:

    Thank you so much!
    Kudos!

  23. Koads says:

    Thx. You saved me. and my hair. and my marriage…

  24. Michel Bardelmeijer says:

    You saved my day:D

  25. xcunik says:

    thanks! <3

  26. ravi says:

    thanks , how easy :D god bless

  27. TM420 says:

    thank you thank you thank you thank you!!!!!!!!!

  28. Maulik says:

    Thanxx a ton… works for Drupal too :)

  29. can says:

    thanks a lot dud its very useful post. thnks again..

  30. william says:

    wow.. so simple but that fixed my issue. Thanks

  31. Tina says:

    Thanks! This helped a lot!

  32. Fred says:

    Brilliant ! Thanks a lot for that helpful fix ! :)

  33. cherrybomb says:

    Glorious! Saved the day…

  34. tu says:

    thanks =D

  35. JayKay says:

    Thank you so much, !!!

Leave a Reply