title: Adding a class to all the images within a <div> using javascript & vice versa
body: <p>So I want to add a class to all the images within particular <code>&lt;div&gt;</code> using javascript.
  <br>I have made this code that adds a class to all the images in the webpage:</p>
  
  <pre><code>$(function(){
      $('img').addClass('posts');
  });
  </code></pre>
  
  <p>But i want to add it only for a particular <code>&lt;div&gt;</code>.
  <br>And I need a different version that excludes the images from adding class within a <code>&lt;div&gt;</code>
  <br>How is it possible?</p>