JSFiddle - React, Tailwind, and code Playground

by easter bunny

HTML

<p>ddd</p>
<p>fff</p>
<input type='button' value='remove all elements' onClick="removeall()">

JavaScript

function removeall(){
  var para=document.getElementsByTagName('P');
  alert(para.length);
  for(i=0;i<para.length;i++){
     document.body.removeChild(para[i]);
  }

}