Using JavaScript To Create A Chrome-style Alert
How do I create an alert in Chrome using JavaScript that opens a text box in the middle of the browser window and washes out the background, like so: rather than an alert that jus
Solution 1:
You should use the dialog element. Something like this:
HTML:
<dialog>
This is a dialog.<br>
<button>Close</button>
</dialog>
Javascript:
var dialog = document.querySelector("dialog")
dialog.querySelector("button").addEventListener("click", function() {
dialog.close()
})
dialog.showModal()
Post a Comment for "Using JavaScript To Create A Chrome-style Alert"