---
# System prepended metadata

title: Untitled

---


```javascript=
// Step 1 : Add class "show" in HTML to anywhere you need
// Step 2 : Add Attribute "data-show:.." in HTML with Step 1
// Step 3 : Add this script into your project

document.addEventListener("DOMContentLoaded", function(){

     var button = document.getElementsByClassName('toClick');
     var content = document.getElementsByClassName('toShow');
     
     for (var i = 0; button.length; i++){
            button[i].onclick = function(){
                 if (this.classList[1] == 'white'){
                     this.classList.remove('white');
                     var contentShow = this.getAttribute('data-show');
                     var elementShow = document.getElementById(contentShow);
                     elementShow.classList.toggle('show');
                 }

                 else{
                     for(var k = 0; k < button.length; k++){
                         button[k].classList.remove('white');
                     }
                     this.classList.toggle('white');
                     var contentShow = this.getAttribute('data-show');
                     var elementShow = document.getElementById(contentShow);
                     for(var i = 0; i < content.length; i++){
                     content[i].classList.remove('show');
                 }

             elementShow.classList.toggle('show');
            }
        }
    }
},false)

```

