HTML DOM Abbreviation Object

HTMLWeb DevelopmentFront End Technology

The <abbr> element is used in HTML to display abbreviations. The Abbreviation object represent this <abbr> element.

In the below example, we will learn how to access an abbreviation object −

Example

 Live Demo

<!DOCTYPE html>
<html>
<body>
<h2>Demo Heading</h2>
<abbr id="myid" title="Board of Control for Cricket in India">BCCI</abbr>
<button onclick="display()">Display the abbreviation title</button>
<p id="demo">Abbreviation Title

<script>    function display() {       var a = document.getElementById("myid").title;       document.getElementById("demo").innerHTML = a;    } </script> </body> </html>

Output

Click on the button to display the title −

raja
Published on 18-Jun-2019 12:01:35
Advertisements