The Dark Knight
The Dark Knight

Reputation: 5585

JavaScript daignostic : $ is not a function

I am facing a weird problem here :

In Firebug I see this error :

$ is not a function

_handleEvent() in pro.js 
 e = load
 var handlers = this.events[e.type], el = $(this);

The full function is defined as follows:

_handleEvent : function(e) {
 var returnValue = true;
 e = e || Event._fixEvent(window.event);
var handlers = this.events[e.type], el = $(this);
for (var i in handlers) {
    el.$$handleEvent = handlers[i];
    if (el.$$handleEvent(e) === false) returnValue = false;
}
return returnValue;
}

Can you kindly help me out here and figure out why is this error being thrown here. It's not related to jQuery, I guess.

NOTE : It gives this error in IE:

$(this ) is not a function

Upvotes: 0

Views: 83

Answers (1)

sudoremo
sudoremo

Reputation: 2402

I think you've either not loaded jQuery correctly or you are executing this code before the inclusion of jQuery. Or you might be using jQuery's noConflict-mode, http://api.jquery.com/jQuery.noConflict/, in which case you'd need to replace $() by jQuery().

Also, make sure you execute this code either at document load or, even better, when jQuery is loaded:

$(document).ready(function() {
  // your code goes here
});

Upvotes: 1

Related Questions