title: How to select a css class with jquery from an external stylesheet
body: <p>I am trying to select a button every time I press it, it changes to a different style of my css, the problem is that this code is made for online css code, if I want to take it for example from the <code>css/stilos.css</code> folder and make jquery find the class from there as it should? this can?</p>
  <pre><code>const switchButton = $(&quot;button#switch&quot;);
   
  $('button').click(switchButton, function(e) {
  
      document.body.classList.toggle('dark'); //toggle the HTML body the class 'dark'
      switchButton.classList.toggle('active');//toggle the HTML button with the id='switch' with the class 'active'
  });
  </code></pre>
  <p>I also attach the html code</p>
  <pre><code>&lt;button class=&quot;darkModeSwitch&quot; id=&quot;switch&quot;&gt;
        &lt;span&gt;&lt;i class=&quot;fas fa-moon&quot;&gt;&lt;/i&gt;&lt;/span&gt;   
        &lt;span&gt;&lt;i class=&quot;fas fa-sun&quot;&gt;&lt;/i&gt;&lt;/span&gt;
  </code></pre>
  <p>I would like to know if these lines:</p>
  <pre><code>document.body.classList.toggle('dark'); //toggle the HTML body the class 'dark'
  
  switchButton.classList.toggle('active');//toggle the HTML button with the id='switch' with the class 'active'
  </code></pre>
  <p>is there a way to call them in another way that I don't know to access this external css file and get these classes.</p>