I am working on a jQuery plugin. I want to define a statically visible method so that I can easily access some parts. For example, in C #, I would just do this:
public class MyPlugin() { public static string DoSomething(object parameter) { return DoImplementation(); } }
However, I cannot figure out how to do this in the jQuery plugin. I currently have the following:
(function ($) { $.myPlugin = function (element, options) { var defaults = { average: 0 } myPlugin.init = function () { myPlugin.settings = $.extend({}, defaults, options); } myPlugin.doSomething = function (parameter) {
How to create a statically visible method from a jQuery plugin?
Thanks!
source share