A simplified version of what i'm trying to do is as follows:
var indication = $('#some-div');
indication.bind('custom-event', function() { ... }
// ... later on!
function OtherThing() {
$(this).trigger('custom-event');
}
I'd like indication.bind('custom-event')
to receive the trigger from function OtherThing
without the two having to explicitly know about each other. Is this possible? My only solution so far is to bind both the listener and the event to body ... this seems sloppy -- is there a better way?
$(this).trigger
into$('#some-div).trigger
and have it work but that defeats the purpose. As I stated my current solution is to bind both the listener and the emitters to$('body')
– Gran