Simple Show/Hide Toggle With Pure JavaScript

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.


See more:

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this: