Javascript DOM HTML S Object create

Introduction

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

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

Click the button to create a S element.

View in separate window

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

<script>
function myFunction() {//from  ww  w .  ja  va  2  s .c  o m
  var x = document.createElement("S");
  var t = document.createTextNode("Some text that is no longer correct");
  x.appendChild(t);
  document.body.appendChild(x);
}
</script>

</body>
</html>



PreviousNext

Related