title: Clear content with button
body: <p>I am able to save user data from input field into paragraph, but I want to delete the contents of the paragraph with a click of button.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;input type="text" id="name" placeholder="enter"&gt;
  &lt;br&gt;
  &lt;button id="btn" onclick="fn()"&gt;click&lt;/button&gt;
  &lt;div&gt;
      &lt;p id="result"&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;button onclick="clear()"&gt;clear&lt;/button&gt;
  </code></pre>
  
  <p>JAVASCRIPT:</p>
  
  <pre><code>function fn(){
      var Name = document.getElementById('name').value;
      document.getElementById('result').innerHTML += '&lt;br&gt;' + Name;
  }
  function clear(){
      document.getElementById('result').innerHTML = "";
  }
  </code></pre>