Jump to content

Extending a jQuery plugin


x1nick

Recommended Posts

I have a default plugin

 

(function($) {
$.lsc = function (json) {
	$.lsc.vars = json;
if (json['toolbar']) $.lsc.toolbar ();
}	
//Create essential functions
$.extend ($.lsc, {
	init: function () {
		//some code
	},
});
});

 

This appears to work fine

 

Now when my whole project is in debug mode, a seperate javascript file is loaded with the following

 

(function($) {
//Create essential functions
$.extend ($.lsc, {
	toolbar: function () {
		alert(1);
	},
});
});

 

But I get the following error: $.lsc.toolbar is not a function

 

How can I create a plugin and extend in a seperate file with additional functions when my project is in debug mode?

 

I have never written a jQuery plugin before and struggling to get my head round it

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.