how to save the dom element and store to a variable and how to call it
<p>i want to save element dialog box and save it to a variable so i can use it again,my problem is how to connect them...
here is my code.</p>

<pre><code>$(function() {
    $( "#dialog-upload" ).dialog({
    autoOpen: false,
    closeOnEscape: false,
    modal: true,
    height: 'auto',
    width: 350,
    show: 'fade',
    hide: 'fade',
    position: [300,120],
    resizable: false,
    title: 'Wirin Upload Image'
    });
    $(".ui-dialog-titlebar-close").click(function() {
        $( "#p-oname" ).empty();
        $( "#p-preview").empty();
        $( "#p-name" ).empty();
        $( "#p-tbname" ).empty();
        $( "#p-type" ).empty();
        $( "#p-size" ).empty();
        $( "#p-preview" ).append($("#preview").html());
        $( "#p-oname" ).append($("#oname").html());
        $( "#p-name" ).append($("#name").html());
        $( "#p-tbname" ).append($("#tbname").html());
        $( "#p-type" ).append($("#type").html());
        $( "#p-size" ).append($("#size").html());
        $( "#dialog-upload" ).dialog( "close" );
    });
    $( "#upload" ).click(function() {   
        $( "#dialog-upload" ).dialog( "open" );
    });
});
</code></pre>

<p>into this</p>

<pre><code>var saveElement = document.getElementByID('dialog-upload');
</code></pre>

<p>.....</p>
