** Update – trying to find the number of elements with an empty src **
I need to find the number of img elements with a populated src – eg: not src=””
Trying this:
if(!$('div.previewWrapper div.previewContainer').find('img[src=""]').length > 0) {
alert(numPhotos);
}
HTML
<div class="previewWrapper" id="thumbPreview3">
<div class="previewContainer">
<img src="" class="photoPreview" data-width="" data-height=""><span>3</span>
</div>
</div>
thx
Try this
EDIT: jQuery has a neat != attribute selector
EDIT2: The OP now wants the number of images with empty src