So i'm making this button which changes background-color when you click it, but when you click it again the color goes back to default(the color it was before you first clicked). this is my HTML:
<span onclick="Switch(this)" class="button" id="button1">button</span>
and my javascript:
<script type="text/javascript">
        function Switch(obj) {
            var div = document.getElementById(obj);
            if(div.style.backgroundColor === "#6DFC93"){
                div.style.backgroundColor = "#27D956";
            }else{
                div.style.backgroundColor = "#6DFC93";
            }
        }
    </script>
Any suggestions?
 
     
     
     
     
     
    