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!
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
Mayur PandeCourses Plus Student 11,711 Points
why do we toggle after the conditional?
Bit confused on why we toggle after the if statement? I would've thought we would toggle after the condition is set, and then toggle?
Owa Aquino19,277 Points
In the video, Andrew is creating a function named editTask in which he can add to the "Edit" button to add a class of .editMode in the parent <li> of that task item. He added toggle function so if he clicked the "Edit" button he'll be able to add and remove that class (.editMode).
If you check the CSS of that project he's using the .editMode class to style the task item. So if the task <li> has the .editMode class then some elements will be shown (in this case the <input> element).
Hope this clarify your question.