How to remove all divs except the first one from <body> using jQuery?
<p>I have html page and I need remove all div except the div with id="allPage" and except all content of div with id="allPage". I have next code:</p>

<pre><code>&lt;body&gt;
&lt;div class="page" id="allPage"&gt;
    &lt;div id="header"&gt;
        &lt;div id="title"&gt;
            &lt;h1&gt;&lt;a href="/"&gt;here&lt;/a&gt;&lt;/h1&gt;
        &lt;/div&gt; 
        &lt;!-- Many other divs --&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;script type="text/javascript"&gt;
    // Some script
&lt;/script&gt;

&lt;!-- Next div maked by dialog of jQuery --&gt;
&lt;div style="display: none; z-index: 100; outline: 0px none;" class="ui-dialog ui-widget ui-widget-content ui-corner-all alert" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-CreateWarehouse"&gt;
    &lt;div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"&gt;
        &lt;span class="ui-dialog-title" id="ui-dialog-title-CreateWarehouse"&gt;Create warehouse&lt;/span&gt;
        &lt;a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button"&gt;&lt;span class="ui-icon ui-icon-closethick"&gt;&lt;/span&gt;&lt;/a&gt;
    &lt;/div&gt;

    &lt;div id="CreateWarehouse" class="ui-dialog-content ui-widget-content"&gt;

        &lt;div class="Editor ui-widget ui-widget-content" id="AddWarehouseInvoiceControl"&gt;
            &lt;form action="#" class="WarehouseInvoice"&gt;
                &lt;input type="hidden" class="Id" value=""&gt;
                &lt;!-- Some other elements --&gt;
            &lt;/form&gt;
        &lt;/div&gt;

        &lt;input type="hidden" class="WICreationResult" value="0"&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p></p>

<p>If I use for it <code>$("body &gt; div:not(#allPage)").remove();</code> I receive next result</p>

<pre><code>&lt;body&gt;
&lt;div class="page" id="allPage"&gt;
    ...
&lt;/div&gt;

&lt;script type="text/javascript"&gt;
    // Some script
&lt;/script&gt;

&lt;div id="CreateWarehouse" class="" style="display: none;"&gt;

    &lt;div class="Editor ui-widget ui-widget-content" id="AddWarehouseInvoiceControl"&gt;
        &lt;form action="#" class="WarehouseInvoice"&gt;
            &lt;input type="hidden" class="Id" value=""&gt;
            &lt;!-- Some other elements --&gt;
        &lt;/form&gt;
    &lt;/div&gt;

    &lt;input type="hidden" class="WICreationResult" value="0"&gt;
&lt;/div&gt;
</code></pre>

<p></p>

<p>How can I remove all divs except the div with id="allPage"?</p>
