This is how to toggle showing and hiding an element with pure JavaScript.
Here is a working example. In this example, the item that gets clicked to toggle has the class “click-to-toggle”. When this is clicked, the list underneath is will be shown. When the heading is clicked again, the list will be hidden. The list will toggle between show and hide with each click.
Questions and Comments are Welcome