DOM Interfaces
HTMLTableCellElement
Represents a td or th cell with span and header-association properties. A header cell's semantics depend on its tag and associations, not on its styling. colSpan must be a positive span. Example result: 2.
Formal Syntax & Structure
html syntaxhtml
const element = document.getElementById('demo'); // HTMLTableCellElementReturn Value
HTMLTableCellElement
An existing HTML DOM object associated with the td element in this example; this interface is a type, not a function return contract.
Working Example
Example Snippethtml
<table> <tr> <td id="demo" colspan="2">Total</td> </tr></table><p> Result: <output id="result"></output></p><script> const e = document.getElementById('demo'); const result = value => { document.getElementById("result").textContent = String(value); }; result(e.colSpan);</script>