I want to check if a “particular” class is applied to a span inside a div or not.So i tried
$('#div').click(function() {
console.log($(this).find('.myImgClass').length); // returns 0-if not found
// 1 if found
}
HTMl
<div>
<span class="myImgClass"></span>
</div>
Is this the right way to do it ?
This should do the trick,
Example on JSFiddle.net
If you only need divs with the class then: