The DOM Blockquote Object is used to represent the HTML <Blockquote> element. The Blockquote element is accessed by getElementById().
Syntax
document.getElementById("id");
Where “id” is the ID assigned to the blockquote tag.
Property Value
- cite: It is used to Sets or return the value of the cite attribute of a quotation
Example 1: In this article, we will use DOM Blockquote Object
HTML
<!DOCTYPE html>
< html >
< head >
< title >DOM blockquote object</ title >
< style >
body {
text-align: center;
}
h1 {
color: green;
}
</ style >
</ head >
< body >
< h1 >GeeksforGeeks</ h1 >
< h2 > DOM Object</ h2 >
< blockquote ID = "GFG" cite = "www.geeksforgeeks.org" >
GeeksforGeeks: A computer science portal for geeks
</ blockquote >
< button onclick = "myGeeks()" >Submit</ button >
< p id = "sudo" ></ p >
< script >
function myGeeks() {
let w = document.getElementById("GFG").cite;
document.getElementById("sudo").innerHTML = w;
}
</ script >
</ body >
</ html >
|
Output:
Example 2: Blockquote Object can be created by using the document.createElement method.
html
<!DOCTYPE html>
< html >
< head >
< title >DOM blockquote object</ title >
< style >
body {
text-align: center;
}
h1 {
color: green;
}
</ style >
</ head >
< body >
< h1 >GeeksforGeeks</ h1 >
< h2 > DOM Object</ h2 >
< button onclick = "myGeeks()" >Submit</ button >
< p id = "sudo" ></ p >
< script >
function myGeeks() {
let g = document.createElement("BLOCKQUOTE");
let f = document.createTextNode("GeeksforGeeks:" +
"A computer science portal for geeks.");
g.setAttribute("cite", "www.geeksforgeeks.org");
g.appendChild(f);
document.body.appendChild(g);
}
</ script >
</ body >
</ html >
|
Output:
Supported Browsers: The browser supported by DOM Blockquote Object are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
15 Jun, 2023
Like Article
Save Article