jQuery send message to plugin -


I have a custom plug-in, with a constructor like this:

  (Function ($) {$ .fn.extend ({myplugin: function (options) {[...]  

In the plugin, I have a bunch of other functions. Your plugin has a Dom-element:

  $ ('myelement') Myplugin ()  

and after that I send the plugin to wrap the message. I want to document, basically, I want to call internal functions with custom parameters from outside. How can I get it?

Thank you very much.

I have jquery I follow the following pattern during the development of plugins: Its very useful:

  (function ($) {$ .fn.myWidget = function (option) {var defaults = {// Default options}; // These are our last options var opts = $ .extend (default, option); // personal functions my myfunc = fu connection (param) {}; // Our widget object var widget = {functionA: function (StrMsg) {// Make Something Important Obtained internal function myFunc}, functionB: function (idx) {// Some important}}; // Widget Object Return widgets come back; // This will help you call you on your widget}; }) (JQuery); Var w = $ ("# myDiv"). MyWidget (); W.functionA ("hell (o)");  

Another way to do this:

  (function ($) {$ .fn.myWidget = function (options) {var defaults = {// Default option}; // These are our last options var opts = $ .extend (default, option); // personal functions my myfunc = function (param) {}; this.functionA = function (strMsg) {}; function b = Function (ultimate) {}; return it;};}) (jQuery); Var w = $ ("# myDiv"). MyWidget (); W.functionA ("hell (o)");  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -