I have the following HTML:
 <div class="previewWrapper" id="thumbPreview3">
  <div class="previewContainer">
   <img src="" class="photoPreview" data-width="" data-height=""><span>3</span>
  </div>
 </div>
And I have the following JQUERY which isn't working.
    if($('div.previewWrapper div.previewContainer img').attr('src') == '') {
      alert('got me');
    }
can anyone advise what I'm missing. What to get the click event to work when the src is empty.
thx
You should do your verification inside document ready function
$(document).ready(function(){
   if($('div.previewWrapper div.previewContainer img').attr('src') == '') { 
      alert('got me'); 
    }
});
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With