Here's what I would use to separate the selector from the event name: <script type="text/javascript"> var sel,event = 'a.menu:click.namespace'; if (event.indexOf(':')) { sel = event.substr(0,event.lastIndexOf(':')); event = event.replace(sel+':',''); }
alert('selector:'+ sel +" \nevent:" + event); </script> The only drawback when using the this method is that users will not be able to support multiple event names within the same bind call: $(context).bind('click',callback); // normal use $(context).bind('click mouseover',callback); // multiple events $(context).bind('a.menu:click',callback); // using event delegates - only one event at a time -- You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-...@googlegroups.com. To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=.