jQuery plugin scope issue
<p>I'm overlooking something here with scope resolution in this jQuery plugin. Here is a simplified example of what I'm trying to achieve:</p>

<pre><code>(function($) {
    $.fn.dashboard = function(options) {
        this.onClick = function(e) {
            alert("do something");
            return false;
        };

        var createButton(parent) {
            //This should call the onClick method defined above when the link is clicked.
            var button = $('&lt;a href="#"&gt;Reply&lt;/a&gt;').click(this.onClick);
            parent.append(button);
        };

        return this.each(function() {
            var doc = $('body');
            createButton(doc);
        });
    };
})(jQuery);
</code></pre>

<p>The issue is that onClick never gets called. Definitely seems to be some manner of scope issue.</p>
