You're correct about the name-spacing. The name-space comes after the
event "type":

$('.class').bind('click.namespace', function(){//});
$('.class').trigger('click.namespace');

(from: http://docs.jquery.com/Events_%28Guide%29 )

Karl

On Wed, Mar 26, 2008 at 5:34 AM, Guy Fraser <[EMAIL PROTECTED]> wrote:
>
>  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
>

Reply via email to