You're allowed to pass in an array object along with each trigger method call. So this might work for you: var call = 1; $('.foo').trigger('bar.update',[call]]); var call = 2; $('.foo').trigger('bar.update',[call]]); $('.foo').bind('bar', function(e,data) { if (data[0] == 1) { // I came from call 1 } else { // i came from call 2 } });
_____ From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Guy Fraser Sent: Tuesday, March 25, 2008 1:34 PM To: jquery-en@googlegroups.com Subject: [jQuery] Event namespacing - how to see the full event name? Hi, I've been triggering several events as follows: $('.foo').trigger('bar.update'); $('.foo').trigger('bar.show'); etc... If I listen to the bar event on foo: $('.foo').bind('bar', function(e) { // e.type = 'bar' }); The event type property is always "bar" - how do I work out if "bar.update" vs. "bar.show" was triggered? I might be misunderstanding the event system (or more accurately it's namespacing) but I imagined that I could listen to a specific "bar" event: $('.foo').bind('bar.update', handler); Or all "bar" events (bar.update, bar.show, etc): $('.foo').bind('bar', handler); When listening to all of them with a single handler, it would be useful for the handler to see the full event name ("bar.update" instead of just "bar") so I could switch on event type inside the handler. I guess I could achieve the required effect using event data, but it seems such a waste not to have the full event name in the event type (or possibly a .name property could contain it?) Any ideas? Guy