Get Column Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Column


The Column object represents an HTML <col> element.

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
table, th, td {
    border: 1px solid black;
</style>/*w  w w.j  a va2 s  . co m*/

    <col id="myCol" span="2" style="background-color:#EEE">
    <col style="background-color:yellow">

<button onclick="myFunction()">get the number of columns a COL element should span</button>

<p id="demo"></p>

function myFunction() {
    var x = document.getElementById("myCol").span;
    document.getElementById("demo").innerHTML = x;


Related Tutorials