TypeError: 'undefined' is not a function (evaluating '$(document)')


  1. I'm using a WordPress site.
  2. I'm including this script in the header.

When the script loads, I get this error:

TypeError: 'undefined' is not a function (evaluating '$(document)')

I have no idea what is causing it or what it even means.

In firebug, I get this:

$ is not a function

This question is tagged with jquery wordpress

~ Asked on 2011-11-02 02:11:33

The Best Answer is


Wordpress uses jQuery in noConflict mode by default. You need to reference it using jQuery as the variable name, not $, e.g. use


instead of


You can easily wrap this up in a self executing function so that $ refers to jQuery again (and avoids polluting the global namespace as well), e.g.

(function ($) {

~ Answered on 2011-11-02 02:33:35


Use jQuery's noConflict. It did wonders for me

var example=jQuery.noConflict();
    example('span#resultado').text("Hello, dude!");

That is, assuming you included jQuery on your HTML

<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

~ Answered on 2012-07-10 23:20:51

Most Viewed Questions: