<body>
<div id="parent">
<div id="children">Children</div>
<div onclick="removeMe(this);">Remove me</div>
123
</div>
<input type="button" onclick="killChild('parent', 'children');" value="Kill Children" />
<script>
function removeMe(ele) {
ele.parentNode.removeChild(ele);
}
function killChild(parent_id, child_id) {
document.getElementById(parent_id).removeChild(document.getElementById(child_id));
}
</script>
</body>
Title:
How to remove element
Description:
<body> <div id="parent"> <div id="children">Children</div> <div onclick="removeM...
...
Rating:
4