HTML | DOM Abbreviation Object
The DOM Abbreviation Object is used to represent the HTML <abbr> element. The abbreviation element is accessed by getElementById().
Example 1:
<!DOCTYPE html> <html> <head> <title> HTML DOM Abbreviation Object </title> <script> function myGeeks() { var abbr = document.getElementById("sudo").title; document.getElementById("geeks").innerHTML = abbr; } </script> </head> <body> <h2>DOM Abbreviation Object</h2> <abbr id = "sudo" title="GeeksforGeeks"> GFG </abbr><br><br> <button onclick = "myGeeks()"> Submit </button> <p id = "geeks"></p> </body> </html> |
Output:
Before click on the button:

After click on the button:

Example 2: Abbreviation Object can be created by using the document.createElement Method.
<!DOCTYPE html> <html> <head> <title> HTML DOM Abbreviation Object </title> <!-- script for Abbreviation Object --> <script> function myGeeks() { var w = document.createElement("ABBR"); var f = document.createTextNode("GFG"); w.setAttribute("title", "GeeksforGeeks"); w.appendChild(f); document.getElementById("sudo").appendChild(w); } </script> </head> <body> <h2>DOM Abbreviation Object</h2> <button onclick = "myGeeks()"> Submit </button> <p id = "sudo"></p> </body> </html> |
Output:
Before Click on the button:

After click on the button:

Supported Browsers: The browser supported by DOM Abbreviation Object are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Recommended Posts:
- HTML | DOM Object Object
- HTML | DOM Ul Object
- HTML | DOM DFN Object
- HTML | Object tag
- HTML | DOM Div Object
- HTML | DOM DD Object
- HTML| DOM Ins Object
- HTML | DOM DT Object
- HTML | DOM dl Object
- HTML | DOM Kbd Object
- HTML | DOM S Object
- HTML | DOM Ol Object
- HTML | DOM Pre Object
- HTML | DOM Nav Object
- HTML | DOM li Object
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.



