Javascript examples for DOM HTML Element:Abbreviation
You can create an <abbr> element by using the document.createElement() method:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="myP"></p> <script> function myFunction() {/* w w w . j a v a 2s .c o m*/ var x = document.createElement("ABBR"); var t = document.createTextNode("abbr text"); x.setAttribute("title", "title of abbr"); x.appendChild(t); document.getElementById("myP").appendChild(x); } </script> </body> </html>