Skip to content Skip to sidebar Skip to footer

Delete The Entire Table Rendered From Different Pages Using Javascript

I am having a table like:
in many pages .. All these pages are rendered in a single page. when I

Solution 1:

Here's a rough sample

<html><head><scripttype="text/javascript">functionremoveTable(id)
    {
        var tbl = document.getElementById(id);
        if(tbl) tbl.parentNode.removeChild(tbl);
    }

</script></head><body><tableid="toc"class="toc"border="1"summary="Contents"><tr><td>This table is going</td></tr></table><inputtype="button"onclick="removeTable('toc');"value="Remove!" /></body></html>

Solution 2:

Really want to delete the table altogether?

var elem = documenet.getElementById('toc');

if (typeof elem != 'undefined')
{
  elem.parentNode.removeChild(elem);
}

You could also hide the table rather than deleting it.

var elem = documenet.getElementById('toc');
elem.style.display = 'none';

If you need it later, you could simply do:

var elem = documenet.getElementById('toc');
elem.style.display = 'block';

Solution 3:

<scripttype="text/javascript">functiondeleteTable(){
    document.getElementById('div_table').innerHTML="TABLE DELETED"
  }
</script><divid="div_table"><tableid="toc"class="toc"border="1"summary="Contents"></table></div><inputtype="button"onClick="deleteTable()">

Solution 4:

var tbl = document.getElementById(id);
tbl.remove();

Post a Comment for "Delete The Entire Table Rendered From Different Pages Using Javascript"