title: How to wrap DIV tags with different class names?
body: <blockquote>
    <p><strong>Duplicate:</strong><br>
    <a href="https://stackoverflow.com/q/3542779">How can I add a parent element to a group of paragraph?</a>  </p>
  </blockquote>
  
  
  
  <p>I have the following HTML blocks repeated in the document</p>
  
  <pre><code>&lt;!-- first block --&gt;
  &lt;div class="first"&gt;
     My first div
  &lt;/div&gt;
  &lt;div class="second"&gt;
     My second div
  &lt;/div&gt;
  
  &lt;!-- second block --&gt;
  &lt;div class="first"&gt;
     My first div
  &lt;/div&gt;
  &lt;div class="second"&gt;
     My second div
  &lt;/div&gt;
  
  ...
  </code></pre>
  
  <p>How can I wrap the Divs with jQuery to get the resulting HTML like this...</p>
  
  <pre><code>&lt;!-- first block --&gt;
  &lt;div class="container"&gt;
     &lt;div class="first"&gt;
        My first div
     &lt;/div&gt;    
     &lt;div class="second"&gt;
        My second div
     &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;!-- second block --&gt;
  &lt;div class="container"&gt;
     &lt;div class="first"&gt;
        My first div
     &lt;/div&gt;    
     &lt;div class="second"&gt;
        My second div
     &lt;/div&gt;
  &lt;/div&gt;
  
  ...
  </code></pre>