Change the value of the abbr attribute of a <th> element with id "myTh":
document.getElementById("myTh").abbr = "newValue";
Click the button to change the value of the abbr attribute of th with id "myTh".
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; } </style>/*from w w w .java 2 s.co m*/ </head> <body> <table> <tr> <th id="myTh" abbr="Make">Language</th> <th abbr="Model">Usage</th> </tr> <tr> <td>CSS</td> <td>to Style</td> </tr> </table> <br> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myTh").abbr = "Company"; document.getElementById("demo").innerHTML = "The value of the abbr attribute was changed."; } </script> </body> </html>