HTML | DOM TableHeader abbr Property

The DOM TableHeader abbr Property is used to sets or returns the value of the abbr attribute. The abbr attribute is used to specify the shorter version of the content in a header cell.
It has no visual effect on the ordinary web browser and can be used by screen readers.

Syntax:

  • It returns the abbr property.
    tableheaderObject.abbr
  • It is used to set the abbr property.
    tableheaderObject.abbr = text

Property Values: It contains the value i.e text which specify the shorter description of a header content cell.



Return Value: It returns a string value which represents the shorter description of a header content cell.

Example-1: This Example returns a abbr Property.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
  
    <!-- style to set border -->
    <style>
        table,
        th,
        td {
            border: 1px solid black;
        }
    </style>
</head>
  
<body>
  
    <h1>GeeksforGeeks</h1>
  
    <h2>
      DOM TableHeader abbr Property
  </h2>
  
    <table>
        <tr>
            <th id="table" 
                abbr="GeeksforGeeks">
              Username
          </th>
        </tr>
  
        <tr>
            <td>geeks</td>
        </tr>
    </table>
    <br>
    <button onclick="myGeeks()">
        Click Here!
    </button>
    <p id="sudo"
       style="font-size:25px;
              color:green">
  </p>
    <!-- Script to access th element -->
    <script>
        function myGeeks() {
            var tab = document.getElementById(
              "table").abbr;
            document.getElementById(
              "sudo").innerHTML = tab;
        }
    </script>
</body>
  
</html>

chevron_right


Output:
Before Clicking On Button:

After Clicking On Button:

Example-2: This Example sets the abbr Property.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
  
    <!-- style to set border -->
    <style>
        table,
        th,
        td {
            border: 1px solid black;
        }
    </style>
</head>
  
<body>
  
    <h1>GeeksforGeeks</h1>
  
    <h2>
      DOM TableHeader abbr Property
  </h2>
  
    <table>
        <tr>
            <th id="table" 
                abbr="GeeksforGeeks">
              Username
          </th>
        </tr>
  
        <tr>
            <td>geeks</td>
        </tr>
    </table>
    <br>
    <button onclick="myGeeks()">
        Click Here!
    </button>
    <p id="sudo" 
       style="font-size:25px;
              color:green">
  </p>
    <!-- Script to access th element -->
    <script>
        function myGeeks() {
            var tab = document.getElementById(
              "table").abbr = "GeeksUser";
            
            document.getElementById(
              "sudo").innerHTML =
              "The value of the abbr attribute was changed to "
            + tab;
        }
    </script>
</body>
  
</html>

chevron_right


Output:
Before Clicking On Button:

After Clicking On button:

Supported Browsers:

  • Google Chrome
  • Internet Explorer 10.0+
  • Opera
  • Apple Safari
  • Mozilla Firefox


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.