$(document).ready(function(){
$('#cumulative-returns').graph({
width: 400,
height: 180,
graphtype: 'bar'
});
});
J'ai une binded fonction de clic pour #cumulative-returns
et je veux être en mesure d'obtenir la valeur graphtype
comme ..jQuery récupérer le paramètre de la fonction appel
$('#cumulative-returns').click(function() {
alert(this.graphtype)
});
Est-ce possible ou sinon comment vous allez à ce sujet? Peut-être avoir du code dans la fonction graphique qui stocke les paramètres dans un tableau global (désordonné mais faisable)?
* edit: voici la fonction graphique:
(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);
Qu'est-ce que le plugin utilisez-vous? Cela dépend de ça. – Matt