title: jQuery - Select everything except a single elements and its children?
body: <p>I'm trying to remove everything in the whole body, except of a single element and its children. How can I accomplish this?</p>
  
  <p><strong>Edit 1</strong>
  Consider the following markup:</p>
  
  <pre><code>&lt;html&gt;
     &lt;body&gt;
        &lt;div id="div1"&gt;&lt;/div&gt;
        &lt;div id="div2"&gt;
           &lt;div id="elementNotToRemove"&gt;&lt;/div&gt;
        &lt;/div&gt;
        &lt;div id="div3"&gt;&lt;/div&gt;
        &lt;div id="div4"&gt;&lt;/div&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In the above example, I want to remove div1, div3 and div4, as well as their children, but conserve div2 because it contains the element not to remove.</p>