del cite Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Del

Description

The cite property sets or gets the cite attribute of a <del> element, which sets a URL to a document that explains why the text was deleted.

Set the cite property with the following Values

Value Description
URL Sets the source URL to the document that explains why the text was deleted.

Possible values:

  • An absolute URL - like cite="http://www.example.com"
  • A relative URL - like cite="example.html"

Return Value

A String, representing the URL of the source document

The following code shows how to return the URL to a document that explains why some text was deleted:

Demo Code

ResultView the demo 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 . com*/
    var v = document.getElementById("myDel").cite;
    document.getElementById("demo").innerHTML = v;
}
</script>

</body>
</html>

Related Tutorials