We can create a <q> element via the document.createElement()
method:
var x = document.createElement("Q");
Click the button to create a Q element.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {/*w ww.j a v a2 s.c om*/ var x = document.createElement("Q"); var t = document.createTextNode("this is a test."); x.setAttribute("cite", "http://www.java2s.com"); x.appendChild(t); document.body.appendChild(x); } </script> </body> </html>