When trying to toggle an element on a page using jQuery, you might have the toggle happen multiple times. In other words, you click the event listening element (such as a link) and the element you want to toggle expands and collapses, then once more expands and collapses. Obviously, this is not the effect we are going for.

The reason seems to be that the element was bound more than once so it fires once for each binding. The solution is to unbind the element before calling the toggle.

Unbinding it before calling the listener will clear the bindings and then run the listener.

This site uses Akismet to reduce spam. Learn how your comment data is processed.