As I know now .toggle()
method is deprecated in jQuery version 1.9. It is ok, but I was familiar with it. The solution was to import the latest jQuery migrate plugin.
On the official jQuery API documentation I can see that there is a note in the description of the .toggle() method:
Not recommended. Use .toggleClass() instead
Yes, I may use .toggleClass()
instead, but in this case it only switches between two classes.
Also, why is it not recommended to use?