The cite
attribute
specifies a URL to a document that explains why the text was inserted.
The cite
property sets or gets the value of the cite attribute.
The cite property is supported in all major browsers.
cite |
Yes | Yes | Yes | Yes | Yes |
Return the cite property.
var v = insObject.cite
Set the cite property.
insObject.cite=URL
Value | Description |
---|---|
URL | the source cite URL to the document that explains why the text was inserted. |
A String type value representing the URL of the source document.
The following code shows how to change the value of the cite attribute.
<!DOCTYPE html>
<html>
<body>
<ins id="myIns" cite="no_reason.htm">This is an inserted text.</ins>
<p id="demo"></p>
<button onclick="myFunction()">test</button>
<!-- w w w. j av a 2 s .c om-->
<script>
function myFunction() {
document.getElementById("myIns").cite = "http://example.com";
document.getElementById("demo").innerHTML = "changed";
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to get the cite URL.
<!DOCTYPE html>
<html>
<body>
<ins id="myIns" cite="http://example">This is an inserted text.</ins>
<p id="demo"></p>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!--from w w w .j a v a2 s .c om-->
var x = document.getElementById("myIns").cite;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: