i'm challenging myself by creating a website that have a dark and light mode.
When the checkbox is checked, it add the class "light" on the header for example, dark is default mode.
I've created a script but i didn't found the solution and why it's not working, can someone help me in this direction?
Here is my code:
let header = document.getElementsByClassName('header');
let switcher = document.querySelector('#switch');
switcher.addEventListener('click',function(){
    if(this.checked){
        header.classList.add('light');
    }
    else{
     header.classList.remove('light');
     }
})<div class="header ">
            <div class="title-section">
                <h1>Social Media Dashboard</h1>
                <p>Total Followers: 23,004</p>
            </div>
            <div class="switchbtn">
                <label for="switch" id="switchlabel">Dark Mode</label>
                <input type="checkbox" name="switch" id="switch">
            </div>
</div> 
     
     
    