Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

vanilla js

<button onclick="toggleDiv()">Toggle Div</button>

<div id="myDIV" class="hidden">
    This is my DIV content.
</div>

<style>
	.hidden {
      display: none;
    }
</style>

<script>
    function toggleDiv(){
        document.querySelector('#myDIV').classList.toggle('hidden');
    }
</script>
 
PREVIOUS NEXT
Tagged: #vanilla #js
ADD COMMENT
Topic
Name
4+7 =