title: Translate insert new element from prototype de jquery
body: <p>I am trying to translate the following prototype function :</p>
  
  <pre><code>function addCommentDump(message, type, info) {
      var commentDump = $('comment_dump');
      if (!commentDump) {
          var container = $('comment_dump_container');
          if (!container) {
              return;
          }
          container.insert(commentDump = new Element('div', {
              'id': 'comment_dump'
          }));
      }
      if (info) {
          message += ': ' + info;
      }
      commentDump.insert(new Element('span', {
          'class': type
      }).update(message));
  }
  </code></pre>
  
  <p>to a jquery one. Here is the code:</p>
  
  <pre><code>function addCommentDump(message, type, info) {
      //alert("working.....");
      var $commentDump = $('#comment_dump');
      if (!$commentDump) {
          var $container = $('#comment_dump_container');
          if (!$container) {
              return;
          }
          $container.append($commentDump = new Element('div', {
              'id': 'comment_dump'
          }));
      }
      if (info) {
          message += ': ' + info;
      }
      $commentDump.append(new Element('span', {
          'class': type
      }).html(message));
  }
  </code></pre>
  
  <p>I am getting an error: TypeError: Illegal constructor.
  Thanks in advance for your help.</p>