Javascript DOM HTML Cite Object create

Introduction

The Cite object represents an HTML <cite> element.

We can create a <cite> element via the document.createElement() method:

var x = document.createElement("CITE");

Click the button to create a CITE element with some text.

View in separate window

<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Test</button><br><br>

<img src="image1.png" width="100" height="100" alt="The Circle">

<script>
function myFunction() {/*from   ww w  .  j  a va2 s  . c  o  m*/
  var x = document.createElement("CITE");
  var t = document.createTextNode("The Circle.");
  x.appendChild(t);
  document.body.appendChild(x);
}
</script>

</body>
</html>



PreviousNext

Related