title: jquery hasClass matching element
body: <p>In jquery can I combine "closest" or Parents() with "hasClass", so it will give me a closest element with given class, if it exists on a page?</p>
  
  <pre><code>var matchingDiv = $(this).closest('div').hasClass('SomeClass')
  
  if ( matchingDiv != null )
  {
     //we found matching element now manipulate it
  
  }
  </code></pre>
  
  <p>I will always have either one matching div element, or none.
  Thanks.</p>