title: TypeError: document.body is null
body: <p>Why I getting error in browser?</p>
  
  <blockquote>
    <p>TypeError: document.body is null</p>
  </blockquote>
  
  <p>Code is working well in <a href="http://jsfiddle.net/k8b8u5bp" rel="noreferrer">JSfiddle</a>.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script src="jsscript.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p><strong>JS</strong></p>
  
  <pre><code>var creElem = document.createElement("p");
  creElem.innerHTML = "Hellow World";
  creElem.setAttribute("id", "id_name");
  document.body.appendChild(creElem);
  </code></pre>