Javascript Reference - HTML DOM Blockquote cite Property








The cite attribute in blockquote element sets the source URL of a quotation.

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

Browser Support

cite Yes Yes Yes Yes Yes

Syntax

Return the cite property:

var aValue = blockquoteObject.cite;

Set the cite property:

blockquoteObject.cite = URL;




Property Values

Value Description
URL set the source URL of the quotation with an absolute URL or a relative URL.

Return Value

A string representing the URL of the quotation source.

Example

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


<!DOCTYPE html>
<html>
<body>
<blockquote id="myBlockquote" cite="http://www.example.com">
html<!--   w w  w. java 2 s. c  o m-->
</blockquote>
<p id="demo"></p>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {
    document.getElementById("myBlockquote").cite = "http://www.java2s.com";
    document.getElementById("demo").innerHTML = "html tutorial";
}
</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>
<blockquote id="myBlockquote" cite="http://www.java2s.com">
html<!--from  w w w .  j  a  v a  2 s . com-->
</blockquote>
<p id="demo"></p>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {
    var x = document.getElementById("myBlockquote").cite;
    document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>

The code above is rendered as follows: