Javascript DOM HTML Quote cite Property get

Introduction

Return the URL of a quotation:

var x = document.getElementById("myQuote").cite;

Click the button to return the value of the cite attribute of the quotation.

View in separate window

<!DOCTYPE html>
<html>
<body>

<p>Here is a quote from java2s.com's website:</p>

<p>This is a test:
<q id="myQuote" cite="http://www.java2s.com">
Test test test test.</q>
This is a test test.
</p>/*  ww  w.ja v a 2s  . c o  m*/
<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
  var x = document.getElementById("myQuote").cite;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

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

The cite attribute sets the source URL of a quotation.

The cite attribute has no visual effect in ordinary web browsers.

The cite property returns a String representing the URL of the source document.




PreviousNext

Related