views:

15

answers:

2

I'm trying to create a jquery plugin

initially the plugin is used like

$('element').plugin;

Now, i want to extend it further to call specific operations like

$('element').plugin.create;

or

$('element').plugin.delete;

any way of doing this?

A: 

That seems like you want to create a widget. Look here for a good explanation of what widgets do as opposed to plugins: http://bililite.com/blog/understanding-jquery-ui-widgets-a-tutorial/ Typically, you would then call your plugin's methods like this: $('element').plugin('create')

Thomas
+1  A: 

Read through this great tutorial on plugin creation from Justin Meyer

redsquare