title: Javascript appending; What is considered best practice?
body: <p>Can anyone explain what is considered the best practice in appending in javascript?</p>
  
  <pre><code>var element = document.createElement('p');
  element.innerHTML = 'This is appended' ;
  var div = document.getElementById('div');
  div.appendChild(element);
  </code></pre>
  
  <p>or</p>
  
  <pre><code>var div = document.getElementById('div');
  div.innerHTML = '&lt;p&gt;This is appended&lt;/p&gt;';
  </code></pre>
  
  <p>I see a lot of people doing it like this in jQuery:</p>
  
  <pre><code>$('#div').append('&lt;p&gt;This is appended&lt;/p&gt;');
  </code></pre>
  
  <p>But i've always done it like this:</p>
  
  <pre><code>var element = document.createElement('p');
  element.innerHTML = 'This is appended' ;
  $('#div').append(element);
  </code></pre>
  
  <p>Thank you in advance</p>