JSFiddle - React, Tailwind, and code Playground
https://qna.habr.com/q/1109132
by ddv88
JavaScript
let
dialog = document.createElement('dialog'),
myP = document.createElement('p'),
buttonClose = document.createElement('button'),
buttonShow = document.createElement('button'),
container = document.createElement('div'),
myPText = document.createTextNode("Это окно, которое сделано на html5 и javascript");
buttonClose.id = ('close');
buttonClose.appendChild(document.createTextNode("закрыть"));
buttonShow.appendChild(document.createTextNode("открыть"));
buttonShow.id = ('show');
myP.appendChild(myPText);
dialog.appendChild(myP);
dialog.appendChild(buttonClose);
container.id = ('dialog-container');
container.appendChild(buttonShow);
container.appendChild(dialog);
document.body.appendChild( container );
buttonShow.onclick = function() {
dialog.show();
};
buttonClose.onclick = function() {
dialog.close();
};