TableHeader abbr Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:TableHeader


The abbr property sets or gets the abbr attribute, which sets a shorter version of the content in a header cell.

Set the abbr property with the following Values

Value Description
text? Sets a short description of the header cell content

Return Value

A String, representing a short description of the header cell content

The following code shows how to return the value of the abbr attribute of a <th> element with id "myTh":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
table, th, td {
    border: 1px solid black;
</style>//from w  w  w .j  av  a  2s .com

    <th id="myTh" abbr="Make">Item</th>
    <th abbr="Model">Value</th>

<button onclick="myFunction()">Test</button>

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

function myFunction() {
    var x = document.getElementById("myTh").abbr = "Company";
    document.getElementById("demo").innerHTML = "changed";


Related Tutorials