Create a Blockquote Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Blockquote

Introduction

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">create a BLOCKQUOTE element</button>

<script>
function myFunction() {/*from  w w w .j a  va2  s  . c om*/
    var x = document.createElement("BLOCKQUOTE");
    var t = document.createTextNode("text in quote");
    x.setAttribute("cite", "http://www.java2s.com");
    x.appendChild(t);
    document.body.appendChild(x);
}
</script>

</body>
</html>

Related Tutorials