title: JQuery preserves the old input value after the dialog is destroyed
body: <p>I have defined a <code>function</code> for displaying some <code>html</code> content inside a <code>jqueryui dilaog</code>:</p>
  
  <pre><code>function ui_window(title, dialogWidth, content,buttons,className)
  {
    $('&lt;div id="window"&gt;').html(content).
    dialog({
        title: title,
        show: 'drop',
        hide: 'drop',
        width: dialogWidth,
        buttons: buttons,
        close: function (ev, ui) { $(this).remove(); },
        position: { my: 'center', at: 'center', of: window }
  }
     ).addClass(className);
    return false;
  }
  </code></pre>
  
  <p>And here's another javascript <code>function</code> that calls the above <code>function</code>:</p>
  
  <pre><code>function checkForValidCommand()
  {
  var content = getInnerHTML("#checkForValidCommand");
  var myFunc = function ()
  {
      var pensionerID = $('#txtID').val();
          alert(pensionerID);
          $(this).dialog('destroy');
      }
      else
          $('#txtID').focus();
  }
  var buttons = [{ text: 'OK', click: myFunc}];
  ui_window("Pensioner", 410, content, buttons);
  
  }
  </code></pre>
  
  <p>When I call the "<code>checkForValidCommand</code>" for the first time and <code>input</code> a <code>value</code> into the only <code>textbox</code> and press OK I get an alert with the value of the <code>textbox</code>. And then when I call the <code>function</code> again and press OK without enetering anything into the <code>textbox</code> I still get the <code>alert</code>  with the old <code>value</code>. What is the problem in my code? </p>
  
  <p>EDIT:Here's the html content in case you want to see:</p>
  
  <pre><code>&lt;table&gt;
    &lt;tr&gt;
      &lt;td align="right"&gt;
         &lt;label&gt;
             Insert the pensioiner's ID:
         &lt;/label&gt;
      &lt;/td&gt;
      &lt;td&gt;
       &lt;input id="txtID" type="text" onkeydown="return onlyNumbers(event);" maxlength="8"/&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>