title: Cannot insertAdjacentElement of null
body: <p>I have a button element I want to create a ul with a click event. The newly created list should also get a li element. This should also be done with a click element.</p>
  <p>But the querySelector is always null when I try to select the ul to append the li.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>document.querySelector("#add").addEventListener("click", function(e) {
    e.preventDefault();
    let list = document.createElement("ul");
    list.setAttribute("id", "liste");
    document.querySelector("body").insertAdjacentElement("afterbegin", list);
  
    let listelement = document.createElement("li");
    listelement.textContent = "test"
    document.querySelector("liste").insertAdjacentElement("afterbegin", listelement);
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;h2 id="headline"&gt;List&lt;/h2&gt;
  &lt;form id="input-form"&gt;
    &lt;input type="submit" value="Hinzufügen" id="add"&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>