Using jQuery to check each div for element and apply "if" statement
<p>I'm trying to check the page and find the divs that do not have an image and change the class of an element within that div accordingly. The page is being dynamically generated so I need to check each element. The code itself works for affecting all the divs, but I need to check each one and only affect the ones with pictures.</p>

<p>The HTML:</p>

<pre><code>&lt;div class="container"&gt;&lt;img width="695" height="519" src="pic123.jpg" /&gt;&lt;div class="arrow"&gt;&lt;/div&gt;&lt;!--arrow--&gt;&lt;/div&gt;&lt;!--container--&gt;
&lt;div class="container"&gt;&lt;div class="arrow"&gt;&lt;/div&gt;&lt;!--arrow--&gt;&lt;/div&gt;&lt;!--container--&gt;
</code></pre>

<p>The jQuery:</p>

<pre><code>$('.container').each(function(){
if ($(this).has("img")){
$('.arrow').addClass('classone');
};
});
</code></pre>
