window.alert() Alert dialog
Last updated: 2026-09-09
window.alert() Alert dialog
alert shows a modal dialog with a message and OK button. Blocks execution.
| Category | Browser (BOM) |
|---|---|
| ES version | DOM |
📝 Syntax
alert(message);
⚙️ Parameters
| message | The message to display. |
|---|
Returns:undefined.
Mutates the original:No (returns a new value)
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
(alert dialog shown)
⚠️ Warning alert blocks the page — use custom modals or toasts in production.
ℹ️ info alert is text-only, no styling — good for quick debugging.
🌐 Browser support
| Browser | |||||
|---|---|---|---|---|---|
| window.alert() | ✓ v1 | ✓ v12 | ✓ v1 | ✓ v1 | ✓ v1 |
| Supported by all modern browsers | |||||
🏷️ Related Items
💡 Related Cases
More case studies coming soon — check back later.
📚 Related Tutorials
❓ FAQ
QDoes alert block the page?
AYes — user must click OK to continue.
QCan alert be styled?
ANo — use custom HTML modals.
QDoes alert render HTML?
ANo — plain text only.