Javascript DOM HTML Del Object create

Introduction

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

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

Click the button to create a DEL element.

View in separate window

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

<script>
function myFunction() {//from ww  w.  j  a  v  a 2s  .co  m
  var x = document.createElement("DEL");
  var t = document.createTextNode("Some deleted text");
  x.appendChild(t);
  document.body.appendChild(x);
}
</script>

</body>
</html>



PreviousNext

Related