Skip to content
Advertisement

Hide and Unhide div with the same button

I am using a code that unhides a hidden div.

HTML:

JavaScript

JS:

JavaScript

How can I make the same button hide the div after clicking it again? Is it possible to alter the code I am using now?

Advertisement

Answer

use toggle to simple hide and unhide div

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement