title: how to remove element from html using javascript function by clicking on button
body: <p>i am new in javascript i need to call a javascript function when click a button and delete a div element
  below the button element i use</p>
  <pre><code>&lt;button id=&quot;delete_row&quot;  onclick=&quot;deleterow(event,div1)&gt;&lt;/button&gt;
  </code></pre>
  <p>div1 is the id of the div element i want to remove</p>
  <p>javascript function</p>
  <pre><code>function deleterow(event,id) {
  
  event.preventDefault();
  
      var elem = document.getElementById(id);
    elem.remove();//it dosent remove anything
  
    }
  </code></pre>
  <p>this is not working and doesn't remove any thing</p>