Access Keys:
Skip to content (Access Key - 0)
Home (Access Key - 1)
All spaces... (Access Key - 3)
Log in (Access Key - 5)
Sign up (Access Key - 6)
Toggle Sidebar

jQuery Event Namespacing


Just found this blog showing how to namespace events in jQuery:

(function($){
    $.fn.extend({
        clicked: function() {
            return this.bind('click.clicked', function() {
                $(this).addClass('clicked');
            });
        },
        unclicked: function() {
            retun this.removeClass('clicked').unbind('click.clicked');
        }
    });
})(jQuery);

The same blog also contains a Plugin Development Pattern which I highly recommend for anyone developing jQuery plugins.

Toggle Sidebar
Added by Guy Fraser on Dec 05, 2007 00:46, last edited by Guy Fraser on Dec 05, 2007 00:46

Adaptavist Theme Builder Powered by Atlassian Confluence