Hi @ all,

i have a problem with the understanding of public methods of an
plugin. Specialy how to create and link them to the plugin.

For example:
<code>
;(function($)
{
        $.fn.pluginname = function(options)
        {
                var _options = $.extend(
                {
                        label: "data",
                        debug : false
                }, options || {});

                return this.each(function()
                {
                        // this works, of course
                        _doSomethingPrivate();
                        // this too
                        var data = _options.label;
                });

                // private method
                function _doSomethingPrivate()
                {
                        ....
                }
        };

        // public method
        $.fn.pluginname.doSomethingPublic = function()
        {
                // this won't work
                _doSomethingPrivate();
                // this is not accessible either
                var data = _options.label;
        }
})(jQuery);
</code>
Obviously the above code won't work. I've tried several things to get
this working, but had no success.
So please, can somebody explain me this or point me into the right
direction.
If this question was aked before (and i'm somehow sure of this, but
had not found something jet) please let me know the Url.
Sorry for my english, i'm not a native speaker of this language.

Regards
Martin

Reply via email to