A streamlined, but flexible, take on the traditional javascript confirm functionnality with only the minimum required functionality and smart defaults.
Download fileBelow is a statically rendered confirm.
Do you want to perform this action ?
Toggle a confirm via javascript by clicking the button below. It will slide down and fade in from the top of the page.
Launch demo confirm modalCall the confirm via javascript:
$('#myLinkToConfirm').confirmModal();
Configure your confirmModal via Javascript :
$('#myLinkToConfirm').confirmModal({ confirmTitle : 'Custom please confirm', confirmMessage : 'Custom are you sure you want to perform this action ?', confirmOk : 'Custom yes', confirmCancel : 'Cutom cancel', confirmDirection : 'rtl', confirmStyle : 'primary', confirmCallback : defaultCallback, confirmDismiss : true, confirmAutoOpen : false });
You can use HTML5 data attributes to configure the confirm modal:
Name | type | default | description |
---|---|---|---|
data-confirm-title | string | Please confirm | Title of the confirm modal. |
data-confirm-message | string | Are you sure you want to perform this action ? | Message of the confirm modal. |
data-confirm-ok | string | Yes | Validation button's message. |
data-confirm-cancel | string | Cancel | Cancelling button's message. |
data-confirm-direction | string | rtl | Direction for showing buttons, starting with the validation button. |
data-confirm-style | string | primary | Style of the validation button. |
data-confirm-callback | string | defaultCallback | Function to execute when validate modal.. |
data-confirm-dismiss | boolean | true | If modal is dismiss when confirm. |
data-confirm-auto-open | boolean | false | If modal is automatically open when created. |