Javascript examples for DOM HTML Element:Dialog
You can create a <dialog> element by using the document.createElement() method:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">create a DIALOG element with some text</button> <script> function myFunction() {//from ww w . j av a 2s. c om var x = document.createElement("DIALOG"); var t = document.createTextNode("This is an open dialog window"); x.setAttribute("open", "open"); x.appendChild(t); document.body.appendChild(x); } </script> </body> </html>