jQuery Toggle Firing Twice

ben himself's picture

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. How stupid would that look if you left your site working like that? Pretty stupid.

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.

Tags: 

Post date
sp_who2 Alternative (T-SQL, SQL Server) Tuesday, May 1, 2018 - 06:04
Discover How User Is Accessing SQL Instance (PowerShell and T-SQL) Monday, April 30, 2018 - 21:17
MySQL - Move Data Files To New Location (Windows) Thursday, February 15, 2018 - 20:38
PowerShell With Uptime - Getting Days Only Saturday, December 16, 2017 - 16:10
Removing SSMS Boost Friday, June 30, 2017 - 16:04
Flickr Searching Sunday, June 18, 2017 - 18:44
PowerShell - Arrays Friday, May 12, 2017 - 20:19
One Off Thought - Back to Top Monday, February 20, 2017 - 16:31
TempDB Reporting Incorrect File Size Friday, January 20, 2017 - 23:24
SQL Server - Disabled User Account Overrides AD Group Authorization! Wednesday, December 28, 2016 - 18:57