Calling multiple instances of jQuery plugin
<p>I have a simple jQuery plugin that I want to be able to call on multiple elements on a single page.</p>

<p>As of now I declare selectors explicitly, but I would like them to be relative to the object the plugin was called on. How can I do this?</p>

<pre><code>(function($) {

    var MyPlugin = function(options){

        var plugin      = $(this); // The entire myPlugin object
        var element     = $("div#plugined div#element"); // An element in myPlugin
        var pluginChild = $( ); // Need selector of what plugin was called on + additional slider. ("div#plugined div#child")

        this.publicFunction = function() {
            // something...
        }

        var privateFunction = function() {
            // something private...
        }
    };

    $.fn.myPlugin = function(options) {

        var defaults = {
            // options
        }

        var options = $.extend(defaults, options);

        var myPlugin = new MyPlugin(options);

        $("div#plugined a.arrow").bind('click', function(e){ // Same problem. Need selector of what plugin was called on + additional slider. ("div#plugined div#child")
            e.preventDefault();
            myPlugin.publicFunction();
        });

        return myPlugin;
    };
})(jQuery);


&lt;script type="text/javascript"&gt;
    $(window).load(function() {
        $('div#plugined').myPlugin();
    });
&lt;/script&gt;
</code></pre>
