Create a Cite Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Cite

Introduction

You can create a <cite> element by using the document.createElement() method:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">create a CITE element with some text</button>

<script>
function myFunction() {/*from  w  w w .  j a v a2  s  .  c om*/
    var x = document.createElement("CITE");
    var t = document.createTextNode("The Scream.");
    x.appendChild(t);
    document.body.appendChild(x);
}
</script>

</body>
</html>

Related Tutorials