jQuery Plugin to replace Javascript’s window.alert(), window.confirm() and window.prompt() functions

Today I am going to share awesome jQuery Plugin to replace Javascript’s window.alert(), window.confirm() and window.prompt() functions. This popup plugin enables you to create alert / confirm / prompt dialog boxes with custom styles & animations.


  • Substitutes Javascript’s window.alert(), window.confirm() and window.prompt() functions
  • Implements jQuery Promise interface
  • Customizable buttons and inputs
  • Flexible message-queue
  • Fully CSS customizable


Include jQuery library with plugins JS+CSS library.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/messagebox.min.css">
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/messagebox.min.js"></script>


Created sample button for all types of popup buttons.

<button class="btn btn-danger demo-1">Alert Box</button>
<button class="btn btn-primary demo-2">Confirm Box</button>
<button class="btn btn-warning demo-3">Prompt Box</button>
<button class="btn btn-info demo-4">Custom Dialog</button>


Here is the list of sample function which can use to display different different types of popup.

$.MessageBox("A plain MessageBox can replace Javascript's window.alert(), and it looks definitely better...");
$( ".demo-1" ).click(function() {
  $.MessageBox("Replace the Javascript's window.alert() functions");
$( ".demo-2" ).click(function() {
    buttonDone  : "Yes",
    buttonFail  : "No",
    message     : "Are You Sure?"
    $.MessageBox("You clicked Yes");
    $.MessageBox("You clicked No");
$( ".demo-3" ).click(function() {
    input    : true,
    message  : "What's your name?"
    if ($.trim(data)) {
        $.MessageBox("Hi <b>"+data+"</b>!");
    } else {
        $.MessageBox("You are shy, aren't you?");
$( ".demo-4" ).click(function() {
    buttonDone  : "OK",
    buttonFail  : "Cancel",
    message     : "You can type whatever you like",
    input       : true,
    speed       : 1000
    $.MessageBox("Well done!");
    $.MessageBox("You rebel!");

See live demo and download source code.


This awesome plugin is developed by gasparesganga. Visit their official github repository for more information and follow for future updates.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.