jQuery retrieve parameter from function call
<pre><code>    $(document).ready(function(){
        $('#cumulative-returns').graph({
            width: 400,
            height: 180,
            graphtype: 'bar'
        });
    });
</code></pre>

<p>I have a binded a function on click to <code>#cumulative-returns</code> and I want to be able to get the <code>graphtype</code> value like..</p>

<pre><code>$('#cumulative-returns').click(function() {
  alert(this.graphtype)
});
</code></pre>

<p>Is this possible or how else would you go about it? Maybe have some code in the graph function that stores the parameters in some global array (messy but feasable)?</p>

<p>*edit: here is the graph function:</p>

<pre><code>(function($) {
    $.fn.graph = function(options) {
        return this.each(function() {
            var defaults = {
                name: $(this).attr('id')
            };
            var opts = $.extend(defaults, options);
            var img = this;
            $.post('../generate_graph.php', opts);
        });
    };
})(jQuery);
</code></pre>
