Javascript Reference - HTML DOM Column Object

The Column object represents an HTML <col> element.

Column Object Properties

Property Description
span Sets or gets the value of the span attribute

Standard Properties and Events

The Column object supports the standard properties and events.


The following code shows how to get a <col> element by using getElementById().

<!DOCTYPE html>
table, th, td {<!--  w  ww .j  a  v  a  2  s. c  o  m-->
    border: 1px solid black;
    <col id="myCol" span="2" style="background-color:red">
    <col style="background-color:yellow">
<button onclick="myFunction()">test</button>
<p id="demo"></p>
function myFunction() {
    var x = document.getElementById("myCol").span;
    document.getElementById("demo").innerHTML = x;


The code above is rendered as follows: