When we click on a 'Recent Projects' button, the projects show. Next, let's hide the projects if we click the 'Recent Projects' button again.
jQuery provides a function named
toggle that is helpful in this situation.
toggle will hide or show an element, each time it is triggered. The syntax looks like this:
toggle can be called directly on an jQuery selector.
toggle is executed, it will hide or show the element that the selector points to. If the element is currently hidden,
toggle will show the element, and vice versa.