title: Check if element is clicked or hasClass
body: <p>I was wondering if it's possible in jQuery to know if an element is clicked or hasClass()</p>
  
  <p>This is what I've tried without success</p>
  
  <pre><code>if($('.subCat span[data-value="all"]').hasClass('checked') || $('.subCat span[data-value="all"]').click()){
          alert('woohoo');
      }
  </code></pre>
  
  <p>So how can I achieve this? I need to script to be executed when clicked or if it has the required class.</p>
  
  <p>Thanks</p>