Javascript DOM HTML Small Object create

Introduction

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

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

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

View in separate window

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

<script>
function myFunction() {/* ww w.j a  v a2s .  c o  m*/
  var x = document.createElement("SMALL");
  var t = document.createTextNode("Some small text");
  x.appendChild(t);
  document.body.appendChild(x);
}
</script>

</body>
</html>



PreviousNext

Related