Defining and accessing variables for jQuery plugins from
<p>I was wondering if there was a way to define variable for a jQuery plugin and have it be viewable from the outside.  (for debugging purposes)</p>

<p>I want this plugin to be possibly invoked on more than one DOM element, so my thinking was that each invocation would maintain its own set of variables.</p>

<p>I was hoping to check the variables' values in Firebug like so:</p>

<pre><code>$('#hp-feat-promo').featuredPromo.moduleValues.totalNumSlides
</code></pre>

<p>but that doesn't work.  Any ideas how this would work, or is my understanding wrong?</p>

<pre><code>(function($){
$.fn.featuredPromo = function (options) {

    /* Inside a jQuery plugin this refers to the jQuery object
     * Inside of the nested function declarations, this refers to the local object, so if 
     * you still want to refer to the original DOM object, you need to hhave a pointer to the top-level this 
     */
    var self = this;

    /* Create some defaults, extending them with any options that were provided */
    var defaults = {
        targetElement: self.find('.window ul li'),
        isAuto: true
    },
    settings = '';

    /* settings is all the configurable parameters, defaults + options (overrides) */
    settings = $.extend(defaults, options);

    this.moduleValues = {
        totalNumSlides: settings.targetElement.length,
        autoRotate: settings.isAuto,
        currentSlide: 0,
        nextSlide: function() {
        },
        prevSlide: function() {
        }       
    };

    return this.each(function() {



    });
};


jQuery(function(){
    $('#hp-feat-promo').featuredPromo();
});
 })(jQuery);
</code></pre>
