Javascript Reference - HTML DOM ins cite Property








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.

Browser Support

The cite property is supported in all major browsers.

cite Yes Yes Yes Yes Yes

Syntax

Return the cite property.

var v = insObject.cite 

Set the cite property.

insObject.cite=URL




Property Values

Value Description
URL the source cite URL to the document that explains why the text was inserted.

Return Value

A String type value representing the URL of the source document.

Example

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:





Example 2

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: