Alert Box Examples

There are three main JavaScript methods which show alert dialogs: alert, confirm and prompt. This page has examples of each.

The following button will display an alert when clicked.

 


The following button will display a confirm dialog when clicked.


 


The following button will display a prompt dialog when clicked.