Javascript Reference - HTML DOM Quote cite Property








The cite attribute specifies the source URL of a quotation.

The cite property sets or gets the value of the cite attribute of a quotation.

Browser Support

cite Yes Yes Yes Yes Yes

Syntax

Return the cite property.

var v = quoteObject.cite 

Set the cite property.

quoteObject.cite=URL




Property Values

Value Description
URL Specifies the source URL of the quotation.

Return Value

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

Example

The following code shows how to Change the URL of a quotation.


<!DOCTYPE html>
<html>
<body>
<q id="myQuote" cite="http://www.example.com">quote</q>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<!--   w  w  w  . j  ava 2 s.  c  o  m-->
<script>
function myFunction() {
    document.getElementById("myQuote").cite = "http://www.example.com/url.htm";
    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 URL of a quotation.


<!DOCTYPE html>
<html>
<body>
<q id="myQuote" cite="http://www.example.com">quote</q>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {<!--  w ww.  ja  va  2  s  .  com-->
    var x = document.getElementById("myQuote").cite;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows: