title: jQuery append inside appended element
body: <p>I have the following jQuery code which works, but it made me ponder if it were possible to do an append action on what was being appended without the need of specifying what I wanted to append to. <code>append().append()</code> didn't do the trick, it just put the two elements next to each other and not a child of the first <code>append()</code> action.</p>
  
  <h1>Works:</h1>
  
  <pre><code>var container = $('#container'),
      child = 'child';
  
  $('#container').append($('&lt;div/&gt;',{
      'id'    : 'child'
  }));
  
  $('#' + child).append($('&lt;a/&gt;', {
      'class' : 'close',
      'href'  : 'javascript:;',
      html    : 'close',
      click   : function(e){
          e.preventDefault();
          $('#' + child).remove();
      }
  }));
  </code></pre>
  
  <h1>Does Not Work:</h1>
  
  <pre><code>var container = $('#container'),
      child = 'child';
  
  $('#container').append($('&lt;div/&gt;',{
      'id'    : 'child'
  })).append($('&lt;a/&gt;', {
      'class' : 'close',
      'href'  : 'javascript:;',
      html    : 'close',
      click   : function(e){
          e.preventDefault();
          $('#' + child).remove();
      }
  }));
  </code></pre>
  
  <p><a href="http://jsfiddle.net/Y8TwW/1/" rel="noreferrer">http://jsfiddle.net/Y8TwW/1/</a></p>