title: Cannot read property 'addClass' of undefined
body: <p>So i am trying to add a class to </li> but it doesnt work</p>
  
  <pre><code>&lt;script&gt;
      var url = document.location.pathname;
      debugger;
      if(url === '/about.php') {
          $('.about').addClass('active');
          //document.getElementsByClassName('about')[0].addClass('active');
          console.log(url);
      }
  //important part start
      if(url === '/index.php') {
          $('.homee').addClass('active');
          document.getElementsByClassName('homee')[0].addClass('active');
          console.log(url); 
      } 
  //important part end
      if(url === '/sch.php') {
          $('.schedule').addClass('active');
          //document.getElementsByClassName('schedule')[0].addClass('active');
          console.log(url);
      }
      if(url === '/images.php') {
          $('.gallery').addClass('active');
          //document.getElementsByClassName('gallery')[0].addClass('active');
          console.log(url);
      }
      if(url ===  '/videos.php') {
          $('.gallery').addClass('active');
      }
      console.log(url);
  
      &lt;/script&gt;
  
  &lt;ul class="menu" &gt;
      &lt;li class='homee' &gt;&lt;a href="index.php"&gt;HOME&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>as you can see i tryed 2 methods and $('.homee').addClass('active'); didnt say Cannot read property 'addClass' of undefined but it still didnt add the class</p>