title: JS - document.createElement does not work
body: <p>I have the following code:</p>
  
  <pre><code>function icon(link) {
  var iccon = document.createElement('div');
  var iccons = document.createElement('td');
  iccon.setAttribute('id', 'icon');
  icons.appendChild(iccons);
  iccon.setAttribute('onclick', 'window.open("' + link + '");');
  iccons.appendChild(iccon);
  var icons = document.getElementById('icons');
  };
  </code></pre>
  
  <p>The HTML code is <a href="http://codepen.io/bacas/pen/RGBvjW" rel="nofollow">here</a>.</p>