Default input text with dialog
<p>I implemented a little jQuery to display a default message in an input element.  I then put the input element in a jQueryUI Dialog.  It works fine except when you enter some text into the input, then close the dialog, then open the dialog, which incorrectly displays the recently entered text in the input element.  How do I modify it so the original text reappears each time the dialog is opened?  Please see <a href="http://jsfiddle.net/Mxf7s/" rel="nofollow">http://jsfiddle.net/Mxf7s/</a> for a live example and the below script.  Thank you</p>

<pre><code>&lt;!doctype html&gt;
&lt;html lang="en"&gt;
    &lt;head&gt;
        &lt;meta charset="utf-8" /&gt;
        &lt;title&gt;jQuery UI Dialog&lt;/title&gt;
        &lt;script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"&gt;&lt;/script&gt; 
        &lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" /&gt;
        &lt;script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"&gt;&lt;/script&gt;

        &lt;script&gt;
            $(function() {
                $("#openDialog").click(function(){$("#myDialog").dialog('open');return false;});
                $( "#myDialog" ).dialog({
                    modal: true,
                    autoOpen    : false,
                    open        : function() {
                        $('#myInput').blur(); //Required if this input is the first one on the dialog since it will automatically be focused on
                        //$('#myInput').val('New Default value1').blur();
                    },
                    close        : function() {
                        //$('#myInput').val('New Default value2');
                    },
                    buttons: {Ok: function() {$( this ).dialog( "close" );}}
                });
                $('.default-value').each(function() {
                    var $t=$(this), default_value = this.value;
                    $t.css('color', '#929292');
                    $t.focus(function() {
                        if(this.value == default_value) {
                            this.value = '';
                            $t.css('color', 'black');
                        }
                    });
                    $t.blur(function() {
                        if($.trim(this.value) == '') {
                            $t.css('color', '#929292');
                            this.value = default_value;
                        }
                    });
                });
            });
        &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;button id="openDialog"&gt;Click&lt;/button&gt;
        &lt;div id="myDialog" title="My Dialog"&gt;
            &lt;input type="text" value="Original Default value" class="default-value" name="myInput" id="myInput" /&gt;
        &lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>
