I found some jQuery code to clear the contents of a div:
$('#masterdiv').empty();
Is there any similar way to do this in raw javascript, without jQuery or any other library?
I found some jQuery code to clear the contents of a div:
$('#masterdiv').empty();
Is there any similar way to do this in raw javascript, without jQuery or any other library?
This code will work.
while (myNode.firstChild) {
myNode.removeChild(myNode.firstChild);
}
Mention the id of the tag on myNode for which you want to remove the inner child.
Please have a look on http://jsfiddle.net/2dJAN/19/
<div class="btn-post">123</div>
$(".btn-post").html("")