title: Jquery Listen for click event and class change
body: <p>I'm trying to listen for the click/toggle event (class change) when a user clicks on the a button created using an a tag: </p>
  
  <pre><code>&lt;a href="#" class="ccc-toggle-shadow"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>The process goes like this: </p>
  
  <p>If the user clicks on the link, a class, toggled, is added to the  tag, the button changes color to red: </p>
  
  <pre><code>&lt;a href="#" class="ccc-toggle-shadow toggled"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>and If the user clicks on the link again, the class, toggled, is removed, the button changes color to green:</p>
  
  <pre><code>&lt;a href="#" class="ccc-toggle-shadow"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>Here is what I have so far to listen to the changes: </p>
  
  <p>So basically when a user clicks on the button, the toggle class is added to the button class automatically. I want to capture the event when the new class has been added. Once it sees that the button has the new class, toggled, do something.</p>
  
  <pre><code>var a = $("a.ccc-toggle-shadow");  
  
  a.on("click", function(e) {
      e.preventDefault();
      var b = $(this);
  
      if (b.hasClass('toggled')) {
          console.log('activated');  //test in console
      } else {
          console.log('deactivated'); // test in console
      }
      return false;
  });
  </code></pre>
  
  <p>I can't seem to get it to work. Can someone please assist me?</p>