A jQuery plugin that binds multiple event handlers which are executed on each consecutive event
Switch branches/tags
Nothing to show
Clone or download
fkling Merge pull request #2 from rickyham/patch-1
Missing closing bracket ;)
Latest commit bf7814a Jul 18, 2014
Failed to load latest commit information.
tests init Feb 10, 2011
README.md init Feb 10, 2011
jquery.func_toggle.js Missing closing bracket ;) Jul 18, 2014


jQuery Function Toggle Plugin

Copyright (c) 2011 Felix Kling. Dual licensed under the MIT or GPL Version 2 licenses.


This plugin enables you to bind multiple event handlers that should be executed one after another.


  • Provides the same interface and features as bind()
  • Non-function arguments, apart from false, are handled as empty functions


The function funcToggle provides the same interface as bind but accepts multiple event handlers:

funcToggle(eventType, [eventData], handler(eventObject),  [handler(eventObject), ...])


This changes the text color on each consecutive click, from to original color to red, to green, to black, to red again and so forth:

element.funcToggle('click', function() {
    $(this).css('color', 'red');
}, function() {
    $(this).css('color', 'green');
}, function() {
    $(this).css('color', 'black');

Bind handlers for multiple events:

    'click': [function() {
            $(this).css('color', 'red');
        }, function() {
            $(this).css('color', 'green');
        }, function() {
            $(this).css('color', 'black');
    'mouseover': [function() {
            $(this).css('background-color', 'red');
        }, function() {
             $(this).css('background-color', 'white');