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?
var matchingDiv = $(this).closest('div').hasClass('SomeClass')
if ( matchingDiv != null )
{
//we found matching element now manipulate it
}
I will always have either one matching div element, or none. Thanks.