Get Table Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Table


The Table object represents an HTML <table> element.

You can access a <table> element by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
table, td {
    border: 1px solid black;
</style>//from w  w  w  .j  a v  a  2  s . c  o  m

<table id="myTable">
    <td>cell 1</td>
    <td>cell 2</td>
    <td>cell 3</td>
    <td>cell 4</td>

<button onclick="myFunction()">remove the first row in the table</button>

function myFunction() {
    var x = document.getElementById("myTable");


Related Tutorials