title: Updating a DIV while writing text into a textarea
body: <p>I would like to "live" update a DIV in the page with the text the user enter in a textarea.
  I have the following markup</p>
  
  <pre><code>&lt;div id="previewNote" class="note yellow" style="left:25;top:25px;z-index:1;"&gt;
      &lt;div class="body"&gt;&lt;/div&gt;
      &lt;div class="author"&gt;&lt;/div&gt;
      &lt;span class="data"&gt;&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and wrote this jQuery code</p>
  
  <pre><code>/* Listening for keyup events on fields of the "Add Note" form: */
  $("[ID$=NoteText]").live('keyup', function(e) {
      if (!this.preview)
          this.preview = $("[ID$=previewNote]");
  
      /* Setting the text of the preview to the contents of the 
         input field, and stripping all the HTML tags: */
      this.preview.find(".body").html($(this).val().replace(/&lt;[^&gt;]+&gt;/ig, ''));
  
  });
  </code></pre>
  
  <p>But the div does not get updated. What do am I missing?</p>
  
  <p>thanks!</p>
  
  <p><strong>EDIT</strong>
  This is the form.</p>
  
  <pre><code>&lt;form action="/Note/SaveOrDelete" id="crudForm" method="post"&gt;&lt;input id="IssueNoteID" name="IssueNoteID" type="hidden" value="0"&gt;
  
  &lt;!-- The preview: --&gt;
  &lt;div id="previewNote" class="note yellow" style="left:25;top:25px;z-index:1;"&gt;
      &lt;div class="body"&gt;&lt;/div&gt;
      &lt;div class="author"&gt;admin&lt;/div&gt;
      &lt;span class="data"&gt;&lt;/span&gt;
  &lt;/div&gt;
  
  &lt;div style="margin: 16px 0px 0px 180px; width: 240px;"&gt;
      &lt;table border="0" cellpadding="3" cellspacing="1" width="100%"&gt;
      &lt;tbody&gt;&lt;tr valign="top"&gt;
          &lt;td colspan="2"&gt;
              &lt;label for="NoteText"&gt;Testo&lt;/label&gt;
              &lt;br&gt;
              &lt;textarea cols="30" id="NoteText" name="NoteText" rows="6"&gt;&lt;/textarea&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr valign="top"&gt;
          &lt;td colspan="2" align="right"&gt;
              &lt;label for="NoteDate"&gt;Data&lt;/label&gt;
              &lt;input id="noteDate" name="noteDate" style="width: 120px" type="text" value="" class="hasDatepicker"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;/tbody&gt;&lt;/table&gt;
      &lt;div style="text-align:right;"&gt;
          &lt;input type="submit" id="btnSave" value="Salva" class="ui-button ui-widget ui-state-default ui-corner-all" role="button" aria-disabled="false"&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>but, listen, I have changed the jQuery code in </p>
  
  <pre><code>/* Listening for keyup events on fields of the "Add a note" form: */
  $("[ID$=NoteText]").live('keyup', function(e) {
      /* Setting the text of the preview to the contents of the 
         input field, and stripping all the HTML tags: */
      $("[ID$=previewNote]").find(".body").html($(this).val().replace(/&lt;[^&gt;]+&gt;/ig, ''));
  });
  </code></pre>
  
  <p>and everything works!!! :O</p>
  
  <p>It is very strange...</p>