Don't show if it is empty, how to do with Javascript or jQuery
<p>I am very new to Javascript and jQuery. I managed to make a dialog box with jQuery, it is giving a warning before submitting. </p>

<p>The problem is I don't want to show the label and field on the warning page if it is empty. I can't do this with PHP because form is not submitted. I need to do with jQuery or Javascript.</p>

<pre><code>&lt;script type="text/javascript" src="js/jquery-1.4.2.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="js/jquery-ui-1.8.2.custom.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="js/thickbox-compressed.js"&gt;&lt;/script&gt;

&lt;script type="text/javascript"&gt;
            $(function(){
                // jQuery UI Dialog    
                 $('#dialog').dialog({
                    autoOpen: false,
                    width: 400,
                    modal: true,
                    resizable: false,
                    buttons: {
                        "Submit Form": function() {
                            document.testconfirmJQ.submit();
                        },
                        "Cancel": function() {
                            $(this).dialog("close");
                        }
                    }
                });

                $('form#testconfirmJQ').submit(function(){
                    $("p#dialog-email").html($("input#emailJQ").val());
                    $('#dialog').dialog('open');
                    return false;
                });

&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;
&lt;form id="testconfirmJQ" name="testconfirmJQ" method="post"&gt;
&lt;fieldset&gt;
&lt;label for="email"&gt;E-mail:&lt;/label&gt;
&lt;input id="emailJQ" type="text" name="emailJQ" value="" /&gt;
&lt;input id="submitJQ" name="submitJQ" type="submit" value="Submit" /&gt;
&lt;/fieldset&gt;
&lt;/form&gt;

&lt;div id="dialog"&gt;
&lt;p&gt;E-mail&lt;/p&gt;
&lt;p id="dialog-email"&gt;&lt;/p&gt;
&lt;/div&gt;


&lt;/body&gt;
</code></pre>
