title: jQuery to select where no children or first child is not image
body: <p>I'm trying to dynamically style some elements on my pages.  So, if I had the following code:</p>
  
  <pre><code>&lt;a href="#"&gt;
    Select Me
  &lt;/a&gt;
  
  &lt;a href="#"&gt;
    &lt;img src="blah.jpg" /&gt;
    Don't select me
  &lt;/a&gt;
  
  &lt;a href="#"&gt;
   &lt;div&gt;Don't select me either&lt;/div&gt;
   &lt;img src="blah.jpg" /&gt;
  &lt;/a&gt;
  
  &lt;a href="#"&gt;
    &lt;div&gt;You can select me too.&lt;/div&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>I would like it to select the first and fourth tags.  </p>
  
  <p>From what I could tell, by using:</p>
  
  <pre><code> $("a:first-child")
  </code></pre>
  
  <p>Won't select the first tag because it doesn't have any children (just text).  The second tag should not get selected so something like:</p>
  
  <pre><code>$("a:first-child").not("img)
  </code></pre>
  
  <p>but that leaves out the first item.</p>
  
  <p><strong>EDIT:</strong> If there is an IMG anywhere in the A element, don't select it.</p>