jQuery if img src equals then apply class name each img
<p>Basically my img src looks like this and has class name .pic:</p>

<pre><code>img/folderA/..
img/folderB/..
img/folderC/..
..
img/folderZ/..
</code></pre>

<p>and I want add class name each of the img example if imc src equals /folderA/ then add that img class name 'thisisA' etc., i tried something like this but it wont work any help?</p>

<pre><code>    $('.pic').each(function(i){
        var imgSrc = this.src;
        if(imgSrc.indexOf('/folderA/')){
            $(this).addClass('thisisA');
        }
            else if(imgSrc.indexOf('/folderB/')){
            $(this).addClass('thisisB');
        }
});
</code></pre>
