title: Exclude child of specific class when jQuery automatically adds prettyPhoto class to links
body: <p>I'm using jQuery to add <code>class="prettyPhoto"</code> to all links that are both inside of <code>&lt;div class="entry-content"&gt;</code> and that contain an image.</p>
  
  <pre><code>$('.entry-content a').has('img').addClass('prettyPhoto');
  </code></pre>
  
  <p>The code works well; however I am having trouble adapting it to exclude any links located within <code>&lt;div class="hover_link"&gt;</code> and I can't figure out how.</p>
  
  <p>After fiddling around I have the following which is producing wierd results:</p>
  
  <pre><code>if(!$('.entry-content a').parent('.hover_link')) {
      $('.entry-content a').has('img').addClass('prettyPhoto');
  }
  </code></pre>
  
  <p>Some sample html:</p>
  
  <pre><code>&lt;div class="entry-content"&gt;
  
      &lt;!-- prettyPhoto should be added to the next link --&gt;
      &lt;a href="whatever"&gt;&lt;img src="whatever.jpg"&gt;&lt;/a&gt;
  
      &lt;!-- prettyPhoto shouldn't be added to the next link (there's no img) --&gt;
      &lt;a href="whatever"&gt;Some Text&lt;/a&gt;
  
      &lt;div class="hover_link"&gt;
          &lt;!-- prettyPhoto shouldn't be added inside of .hover_link --&gt;
          &lt;a href="whatever"&gt;&lt;img src="whatever.jpg"&gt;&lt;/a&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>