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

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


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

jQuery(document);

instead of

$(document);

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 ($) {
   $(document);
}(jQuery));

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


Most Viewed Questions: