Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript jQuery Basics (2014) Creating a Simple Drawing Application Perform: Part 2

My question about method .toggle().

Why we study method toggle() if he listed in API documentation as Deprecated?

2 Answers

Hugo Paz
Hugo Paz
15,622 Points

HI Ilya,

I believe you are confusing the methods, although they do have the same name. The .toggle() used in this video is an animation method and it is not deprecated.

There used to be another .toggle() but it was removed in jquery 1.9. Basically that method allowed you to do something when you clicked on an element and then if you clicked the element again, it would do something else.

Hi Hugo Paz,

Simple, i saw this method in the list http://api.jquery.com/category/deprecated/ and thought that he outdated.

Hugo Paz
Hugo Paz
15,622 Points

I understand your confusion. They are different methods. The one you saw on the list was removed and a new one was added which does something different.

thank you for answer!

Sean T. Unwin
Sean T. Unwin
28,690 Points

I don't see where it says "deprecated" on the reference page. Although, within the menu there is a "Deprecated" section for older versions of jQuery, however that is not related to the toggle() documentation.

thank you for answer!