Yahreen
Yahreen

Reputation: 179

"Function is not defined" - jQuery Plugins Question

I have a plugin in my plugins.js file that looks like this:

var ShowCredits=function(){var a={addEvent:function(b,c,d,e){if(b.addEventList ...etc

Over in my functions.js file I have this:

var credits = new ShowCredits();
credits.code = function() { ...etc

When I lint, I get the following error message:

var credits = new ShowCredits();
'ShowCredits' is not defined.

Which makes sense because of the way the plugin is written.

Is there a way to re-write this so that the code validates?

Thanks a lot,

-Yahreen

Upvotes: 0

Views: 241

Answers (1)

sfk
sfk

Reputation: 709

The keyword new is to instantiate an object of the given class. Obviously, you don't define a class but a function. So just remove "new"

Upvotes: 1

Related Questions