title: jQuery dynamically created element with ID: what happens if the element already exists?
body: <pre><code>    var myWindow = $("&lt;div id='msgwindow'/&gt;").someWidget({
        option1: true,
        option2: someVariableWhoseValueChanges
       });
  </code></pre>
  
  <p>What happens if the code above is executed more than once? Does the element with id #msgwindow get completely or partially overwritten? Is it destroyed first and then re-created? Are there any vestiges hanging around from the previous instance?  What happens to any event listeners?</p>