Get an Abbreviation Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Abbreviation

Introduction

The Abbreviation object represents an HTML <abbr> element.

You can access an <abbr> element by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p>The <abbr id="myAbbr" title="title of abbr">abbr test</abbr> test testtest.</p>

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

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

<script>
function myFunction() {//from  w  w  w  .  ja  v a  2  s . c o m
    var x = document.getElementById("myAbbr").title;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials