title: Button onclick and everything disappears
body: <p>I have been trying to write a code that simulates this example (code below). <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>function closeMe(){
  
       x=document.getElementById("demo");
  
       x.style.display="none";
  
   }
  
  function openMe(){
  
       x=document.getElementById("demo");
  
        x.style.display="block";
  
   }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;h1&gt;Changing the Style&lt;/h1&gt;
   &lt;p&gt;JavaScript can change the style of an HTML element.&lt;/p&gt;
  
   &lt;button type="button" onclick="openMe()"&gt;Open!&lt;/button&gt;
   &lt;button type="button" onclick="closeMe()"&gt;Close!&lt;/button&gt;
  
   &lt;p id="demo"&gt;Extra details...You can open and close this paragraph using the buttons above.&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Unfortunately, in my own code below, when I click the "open" button, all things just disappear. I can't figure out why.</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>function open() {
    x = document.getElementById("demo");
    x.style.display = "block";
  }
  
  function close() {
    x = document.getElementById("demo");
    x.style.display = "none";
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p id="demo"&gt;Click me to change my HTML content (innerHTML).&lt;/p&gt;
  
  &lt;p&gt; this shouldnt disappear&lt;/p&gt;
  
  &lt;button onclick="open()"&gt;open button&lt;/button&gt;
  
  &lt;button onclick="close()"&gt;close button&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Can anyone give me some kind advice?</p>