title: Change CSS Stylesheet when checkbox is marked
body: <p>I was trying to create a checkbox in HTML which changes the current stylesheet to another one using JS.</p>
  
  <p>The style didn't change after i checked the checkbox.
  Here is the error message I got:
  <a href="https://i.stack.imgur.com/N4DMS.png" rel="nofollow noreferrer">Error Message</a></p>
  
  <p>Here is the code I have written:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
      &lt;title&gt;Normal Title&lt;/title&gt;
      &lt;meta name="description" content=""&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
      &lt;link id="pageStyle" rel="stylesheet" href="style.css"&gt;
      &lt;script&gt;
          function swapStyleSheet(sheet) {
  
          if (document.getElementById("lightSwitch").checked == true) {
  
          document.getElementById("pageStyle").set.Attribute('href', sheet) = "dark.css";
  
              } 
          else {
  
          document.getElementById("pageStyle").set.Attribute('href', sheet) = "style.css";
  
              }
          }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
          &lt;input onclick="swapStyleSheet()" id="lightSwitch" type="checkbox" name="lightSwitch"&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>Thanks for clarifying the problem for me.</p>