$(document).ready(function(){
$('#cumulative-returns').graph({
width: 400,
height: 180,
graphtype: 'bar'
});
});
I have a binded a function on click to #cumulative-returns and I want to be able to get the graphtype value like..
$('#cumulative-returns').click(function() {
alert(this.graphtype)
});
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)?
*edit: here is the graph function:
(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);
Then just do: