What is alternative to use after jQuery 1.9 removed .toggle(function,function)?

With two states, you can just maintain the current toggled state as a boolean (I used clickState). If you wanted to have multiple states, you could continue to add 1 to the state count and then check the modulus of the total count to determine which function should fire based on the state.

I updated your code a bit since ele is actually the jQuery object you want to work with:


Leave a Comment