[Solved] function .toggle() deprecated : what to use instead ?

[Solved] function .toggle() deprecated : what to use instead ?

Hi,

The documentation says that the .toggle() function is deprecated (http://api.jquery.com/toggle-event), but there isn't any alternative method indicated.
I searched the documentation but cound't find this piece of information. Maybe with .on() and .off() but I don't understand exactly how it works.

Well, all I want is to transform the following into something future-proof :

  1. var odd = function() {
  2.     alert("odd");
  3. }
  4. var even = function() {
  5.    alert("even");
  6. }
  7. $("#mydiv.toggle(odd, even);

Thanks for any help !