I've been trying to make my if statement work, but I cannot find the solution. Thanks.
<div class="imgContain">
<img class="finalimg" alt="link" src="website.com/imga546.jpg">
<img class="finalimg" alt="green" src="website.com/imga645.jpg">
<img class="finalimg" alt="cap" src="website.com/imga6786.jpg">
<img class="finalimg" alt="sarge" src="website.com/imga31234.jpg">
</div>
Pseudo-code
jQuery if(something = to any of my alt attributes){do...}
//altattr is equal to an attribute that may match the alt attribute
ex: if('link' == $('img[class="finalimg"]').attr('alt'))
if(altattr == $('img[class="finalimg"]').attr('alt')){
//do stuff
}
I have to select the class imgContain first to make this work right? I know that this will only work on my first element, but I'm trying to make the if statement work first.