How to remove element using javascript

Manideepgoud
Posted by Manideepgoud under JavaScript category on | Points: 40 | Views : 1077
We use removeChild() to remove element
<div id="div1">
<p id="p1">TechFunda.</p>
<p id="p2">DotNetFunda</p>
</div>
<script>
var a = document.getElementById("div1");
var b = document.getElementById("p1");
a.removeChild(b);
</script>


It removes the id value which we have given "p1".

Comments or Responses

Login to post response