This question already has an answer here:
jQuery's Toggle Event function has been removed as part of version 1.9.
I was using this function like so:
$('#example').toggle(function() {
do stuff
}, function() {
do stuff
});
What would be the best way to reproduce this functionality now Toggle Event has gone?
This also works well.
Load the MIGRATE and see the code there
See my post about the same thing
Where has fn.toggle( handler(eventObject), handler(eventObject)...) gone?
I have suggested they rename it to fn.toggler instead of removing it
Here is the code - it is a self-contained jQuery plugin and can be used as is.
Shorter, non-tested version: