Jquery - Getting all content inside a DIV EXCEPT a particular object

admin

Administrator
Staff member
how do I get all content inside a DIV? I want to save all the code that exists within #wrapper DIV on my page. That is easy. But the thing is... how do I select all EXCEPT for one particular object (the image with "main" class).

You can see how it works here <a href="http://www.jsfiddle.net/8A27a/" rel="nofollow">http://www.jsfiddle.net/8A27a/</a>

This is what I have so far:

Code:
        &lt;div id="wrapper"&gt;
            &lt;div class="icon"&gt;&lt;img src="http://www.yousendit.com/en_US/theme_default/images/g_logo_trans_110x63.gif"&gt;&lt;/div&gt;
            &lt;div class="icon"&gt;&lt;img src="http://www.yousendit.com/en_US/theme_default/images/g_logo_trans_110x63.gif"&gt;&lt;/div&gt;   
            &lt;div class="icon"&gt;&lt;img src="http://www.yousendit.com/en_US/theme_default/images/g_logo_trans_110x63.gif"&gt;&lt;/div&gt;  
            &lt;img class="main" src="http://afteramerica.files.wordpress.com/2010/01/061221225103_abraham_lincoln_lg1.jpg"&gt;
        &lt;/div&gt;

        &lt;input type="button" value="save" class="save"&gt;

    &lt;script&gt;
$(document).ready(function() { 
            $('.save').live('click', function() {
                var content = $('#wrapper').html();
                alert(content);
             });
});
&lt;/script&gt;