Javascript DOM HTML Blockquote Object get

Introduction

The Blockquote object represents an HTML <blockquote> element.

We can access a <blockquote> element by using document.getElementById():

var x = document.getElementById("myBlockquote");

Click the button to get the URL of the quotation.

View in separate window

<!DOCTYPE html>
<html>
<body>
<blockquote id="myBlockquote" cite="http://www.java2s.com/">
This is a test. This is a test. This is a test. This is a test. 
</blockquote>
<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {/*from  w w w  .  ja  v a  2s .  c o  m*/
  var x = document.getElementById("myBlockquote").cite;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related