title: Move div and its content before and after a divider to a new container
body: <p>I have been trying to move some html before a div to a new div and after a div 
  to a new div .</p>
  
  <p>For eg</p>
  
  <pre><code>&lt;div&gt;&lt;div&gt;DATA&lt;/div&gt;&lt;/div&gt;     
  
  &lt;div&gt;&lt;div&gt;DIVIDER&lt;/div&gt;&lt;/div&gt; 
  
  &lt;div&gt;&lt;div&gt;DATA&lt;/div&gt;&lt;/div&gt; 
  </code></pre>
  
  <p>I want to detect the DIVIDER (separator) and move all the main data div's and inner div above that to a new container and all the main data div's and inner div to a new container . I have attached my progress so far . But it seems to move the above div's and the data again to the below one's to a new div . </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>jQuery( document ).ready(function() {
   jQuery("#layout_post").append("&lt;div class='mi-cst-pg '&gt;&lt;/div&gt;");
   jQuery("#layout_post").append("&lt;div class='mi-cst-pg mi-after'&gt;&lt;/div&gt;");
   //var $e = jQuery("&lt;div&gt;", {id: "newDiv1", name: 'test', class: "aClass"});
     jQuery(".MiniMax_Separator").parents(".mirow-fr").prevAll(".mirow-fr").appendTo(".mi-cst-pg");
    jQuery(".MiniMax_Separator").parents(".mirow-fr").nextAll(".mirow-fr").appendTo(".mi-after");
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div class="w3eden" id="layout_post"&gt;&lt;div class="mirow-fr minimax_content_area row " id="row_55445d450d502" style="margin:px px px px;padding:px px px px;"&gt; 
  
          &lt;div class="gridt col-md-12 minimax_column" id="column_1_55445d450d502"&gt;
                  &lt;div class="minimax_module wow  MiniMax_RichText  animated" style="margin: 0px; padding: 0px; visibility: visible; -webkit-animation-duration: 1s; -webkit-animation-delay: 1s;" data-wow-duration="1s" data-wow-delay="1s"&gt;&lt;p&gt;&lt;a href="/wp-content/uploads/2015/04/838480010005.jpglt_.jpg"&gt;&lt;img class="alignnone size-full wp-image-193" src="/wp-content/uploads/2015/04/838480010005.jpglt_.jpg" alt="838480010005.jpglt" width="470" height="311"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
                      &lt;/div&gt;
   
      
    
   
  
   &lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="mirow-fr minimax_content_area row " id="row_5544b2d36bee4" style="margin:px px px px;padding:px px px px;"&gt; 
  
          &lt;div class="gridt col-md-12 minimax_column" id="column_1_5544b2d36bee4"&gt;
                  &lt;div class="minimax_module wow  MiniMax_Separator  animated" style="margin: 0px; padding: 0px; visibility: visible; -webkit-animation-duration: 1s; -webkit-animation-delay: 1s;" data-wow-duration="1s" data-wow-delay="1s"&gt;&lt;div style="margin-top:15px; margin-bottom:15px; border-top:1px solid "&gt;&lt;!--nextpage--&gt;&lt;/div&gt;&lt;/div&gt;
                      &lt;/div&gt;
   
      
    
   
  
   &lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="mirow-fr minimax_content_area row " id="row_55445dde7d66d" style="margin:px px px px;padding:px px px px;"&gt; 
  
          &lt;div class="gridt col-md-5 minimax_column" id="column_1_55445dde7d66d"&gt;
                  &lt;div class="minimax_module wow  MiniMax_RichText  animated" style="margin: 0px; padding: 0px; visibility: visible; -webkit-animation-duration: 1s; -webkit-animation-delay: 1s;" data-wow-duration="1s" data-wow-delay="1s"&gt;&lt;p&gt;&lt;a href="/wp-content/uploads/2015/04/anigif_enhanced-buzz-12180-1355761194-14.gif"&gt;&lt;img class="alignnone size-full wp-image-194" src="/wp-content/uploads/2015/04/anigif_enhanced-buzz-12180-1355761194-14.gif" alt="anigif_enhanced-buzz-12180-1355761194-14" width="250" height="188"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
                      &lt;/div&gt;
   
      
   
  
          &lt;div class="gridt col-md-7 minimax_column" id="column_2_55445dde7d66d"&gt;
                  
                      &lt;/div&gt;
   
  
    
   
  
   &lt;div style="clear: both;"&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="mi-cst-pg "&gt;&lt;/div&gt;&lt;div class="mi-cst-pg mi-after"&gt;&lt;/div&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>