Javascript DOM HTML Del Object get

Introduction

The Del object represents an HTML <del> element.

We can access a <del> element via document.getElementById():

var x = document.getElementById("myDel");

Click button to get the URL of the page that explains why the text has been deleted.

View in separate window

<!DOCTYPE html>
<html>
<body>
<p><del id="myDel" cite="why_deleted.htm">This text has been deleted.</del></p>
<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//from w  w w .  j a va 2s. c  o  m
  var x = document.getElementById("myDel").cite;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related