The cite
attribute sets a URL to a document which
explains the reason for deleting.
The cite
property sets or gets the
value of the cite
attribute for a del
element.
cite |
Yes | Yes | Yes | Yes | Yes |
Return the cite property:
var aURL = delObject.cite;
Set the cite property:
delObject.cite = URL;
Value | Description |
---|---|
URL | Sets the URL to a document that explains why the text was deleted. |
A URL of the source document to explain the reason to delete.
The following code shows how to get the cite URL.
<!DOCTYPE html>
<html>
<body>
<del id="myDel" cite="http://java2s.com">deleted</del>
<p id="demo"></p>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!-- w ww . java2s. c o m-->
var x = document.getElementById("myDel").cite;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to change the value of the cite attribute.
<!DOCTYPE html>
<html>
<body>
<del id="myDel" cite="http://java2s.com">deleted</del>
<p id="demo"></p>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!-- w ww . j av a 2 s . com-->
document.getElementById("myDel").cite = "http://www.java2s.com/why";
document.getElementById("demo").innerHTML = "changed";
}
</script>
</body>
</html>
The code above is rendered as follows: