title: jQuery: how to add HTML to dynamically created div
body: <p>I am using the below function to create a div dynamically which works fine so far. </p>
  
  <p>How can I add HTML to this div where I am saying "text: userName" ?
  Specifically I would like to add a Bootstrap icon ( <code>&lt;i class="icon-sign-blank"&gt;&lt;/i&gt;</code> ) in front of the userName but when I try this is just adds the HTML as text instead of formatting it as an icon. 
  (Bootstrap is installed correctly.)</p>
  
  <pre><code>function addUser() 
  {
  var userName = $('#userName').val();
  var userElementId = getId(userName);
  
  $('&lt;div/&gt;', {
      text: userName,
      id: userElementId,
      onmouseover: "function1('" + userName + "', this)",
      onmouseout: "function2()",
  }).addClass('user').appendTo('#parentDiv');
  
  if (nameCtrl) {
      nameCtrl.GetStatus(userName, 'users');
  }
  
  $('#userName').val('');
  }
  </code></pre>
  
  <p>Many thanks for any help with this, Tim</p>