title: JavaScript: css toggle switch to dark mode
body: <p>I have created a toggle switch using css.</p>
  
  <p>I want <code>#box1</code> to turn from a white background with black type to a black with white text and the toggle to turn to <strong><em>on</em></strong>. </p>
  
  <p>I'm stuck trying to figure out the JavaScript. The button doesn't switch and the box doesn't turn back to white.</p>
  
  <pre><code>$('#myonoffswitch').change(function(){   
      console.log('here');
      if ($(this).click())
      {
          $('#box1').addClass('dark-mode');
      }
      else
      {
          $('#box1').removeClass('dark-mode');
      }
  });
  </code></pre>
  
  <p>How can toggle the <code>dark-mode</code> class.</p>
  
  <p><strong><a href="http://jsfiddle.net/xhtjecw8/3/" rel="nofollow">Fiddle</a></strong></p>