Ah, non vi preoccupate, ho risolto:
Codice PHP:checkbox: function(target, callback)
{
var image = target.find("img");
// Creo un puntatore all'oggetto
var self = this;
checkbox = target.find(":input");
target.click( function(e)
{
if (self.state = true){
image.attr('src', '/images/CheckFalse.png').css({top: "-0.75em", left: "0.75em"});
// e poi lo uso per modificare this.state anche se sono fuori dallo scope del "this" dell'oggetto
self.state = false;
if (checkbox.length){
checkbox.attr('checked', false);
}
if (callback){
callback(false);
}
}
else {
alert("trigger");
image.attr('src', '/images/CheckTrue.png').css({left: "1em", top: "-0.15em"});
self.state = true;
if (checkbox.length){
checkbox.attr('checked', true);
}
if (callback){
callback(true);
}
}
e.stopPropagation();
e.preventDefault();
return false;
});
return this;
},

Rispondi quotando