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
https://forums.phpfreaks.com/topic/230860-extending-a-jquery-plugin/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.