How to remove parent element and all the respective nodes using plain javascript. I m not using any Jquery or other library. Its like u are havin an element and when user click on that u want to remove the parent to parent element.(also the respective chlds nodes of that)
EDIT
<table id='table'>
<tr id='id'>
<td>
Mohit
</td>
<td>
23
</td>
<td >
<span onClick="edit(this)">Edit</span>/<span onClick="delete_row(this)">Delete</span>
</td>
<td style="display:none;">
<span onClick="save(this)">Save</span>
</td>
</tr>
</table>
Now
function delete_row(e)
{
e.parentNode.parentNode.removeChild(e.parentNode);
}
Will remove only last td. Why cant i remove directly tr cause e.parentNode.parentNode.getAttribute('id')
will return id of row and using this is there any function like remove() delete()...???