Is it possible to override jQuerys target
in a custom event?
f.ex:
var scope = function() {
this.param = 'foo';
}
var instance = new scope();
$(instance).bind('bar', function(e) {
console.log(e.target);
});
$(instance).trigger('bar');
This outputs the entire instance object, as it should.
But if I want target to be something else, like param
I can try:
var scope = function() {
this.param = 'foo';
}
var instance = new scope();
$(instance).bind('bar', function(e) {
console.log(e.target);
console.log(e.customTarget);
});
$(instance).trigger({
type: 'bar',
target: instance.param, // override attempt
customTarget: instance.param
});
This outputs customTarget as 'foo', but target remains the same.
I need to override target, but it seems impossible? I also tried doing so via the jQuery.Event
with no luck.
Anyone?