HTML | DOM Quote Object
The Quote Object in HTML DOM is used to represent the HTML <q> element. The quote element can be accessed by using getElementById() method.
Property Value: It contains single attribute value cite. This attribute is used to set or return the value of the cite attribute in a <q> element.
Syntax:
document.getElementById("ID");
Where ID is assigned to the quote tag.
Example 1:
<!DOCTYPE html> <html> <head> <title> HTML DOM Quote Object </title> </head> <body> <h1>GeeksforGeeks</h1> <h2>DOM Quote Object</h2> <q id = "GFG" cite = "geeksforgeeks.org"> GeeksforGeeks </q> <br><br> <button onclick = "Geeks()"> Submit </button> <p id = "sudo"></p> <script> function Geeks() { var ct = document.getElementById("GFG").cite; document.getElementById("sudo").innerHTML = ct; } </script> </body> </html> |
Output:
Before Click on the Button :

After Click on the Button :
Example 2: Quote Object can be created by using the document.createElement Method.
<!DOCTYPE html> <html> <head> <title> HTML DOM Quote Object </title> </head> <body> <h1>GeeksForGeeks</h1> <h2>DOM Quote Object</h2> <button onclick = "Geeks()"> Submit </button> <script> function Geeks() { var quote = document.createElement("Q"); var txt = document.createTextNode("GeeksForGeeks"); quote.setAttribute("cite", "http://www.geeksforgeeks.org, in"); quote.appendChild(txt); document.body.appendChild(quote); } </script> </body> </html> |
Output:
Before Click on the Button:

After Click on the Button:

Supported Browsers: The browser supported by DOM Quote Object are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Recommended Posts:
- HTML | DOM Object Object
- HTML | Object tag
- HTML | DOM DFN Object
- HTML | DOM Ul Object
- HTML | DOM DD Object
- HTML | DOM li Object
- HTML | DOM Kbd Object
- HTML| DOM Ins Object
- HTML | DOM DT Object
- HTML | DOM dl Object
- HTML | DOM S Object
- HTML | DOM Ol Object
- HTML | DOM Pre Object
- HTML | DOM Nav Object
- HTML | DOM Del Object
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



