Modals


Quick Start

simpleDialog is a jQuery plugin to create responsive, customizable alert, confirmation dialog popups with bootstrap modal components. See the below example to display an Basic confirmation modal

Basic Usage

To display a simple confirmation modal via JavaScript by clicking the button below. It will slide down and fade in from the top of the page.

<script type="text/javascript">
    $(document).ready(function (event) {
        $('#simple-dialog-1').click(function(event){
            event.preventDefault();
            <!-- Initialising simpleDialog with empty parameters -->
           $.simpleDialog({});
        });
    });
</script>

Other Options

Options can be passed via javascript.

Name type default description
backdrop boolean or the string 'static' true Includes a modal-backdrop element. Alternatively, specify static for a backdrop which doesn't close the modal on click.
Title String 'Confirm' This will display as title of modal
Message String 'Do you want to continue?' This will display as text content of modal.
closeButton Boolean true To remove close button from modal set closeButton to false.
closeButtonTemplate String
<button type="button" id ="cancel-btn" class="btn btn-default">Close</button>
This will display as close button of modal.
closeBtnText String 'close' This will display as close button text.
confirmBtnText String 'Okay' This will display as confirm button text.
Example

In this example the modal will pop up with backdrop = false, close button text = 'No! Cancel', confirm button text = 'Yes! Confirm', title = 'Reset Password' and message = 'Do you want to change password'


<script type="text/javascript">
    $(document).ready(function (event) {
        $('#simple-dialog-5').click(function (event) {
            event.preventDefault();
            $.simpleDialog({
                title: "Reset Password",
                message: "Do you want to change password?",
                closeButton: true,
                backdrop: false,
                closeBtnText: "No! Cancel",
                confirmBtnText: "Yes! Confirm",
                onSuccess: function () {
                    alert("You confirmed to change password");
                },
                onCancel: function () {
                    alert("You cancelled");
                }
            });
        });
    });
</script>