simpleprompt

2.3.3 • Public • Published

Simpleprompt

Build Status Coverage Status NPM Status

Simple custom dialog prompts based on jQuery.

Usage

 
Prompt('Are you sure you want to delete this item?', function(){
 
    $.ajax({url: this.href, type: 'DELETE'}).done(function(){ window.location.reload(); });
 
});
 
Prompt('Are you sure you want to delete this item?', function(){ // Confirm callback
 
    console.log('Executing confirm logic...');
 
}, function(){ // Optional cancel callback
 
    console.log('Canceling...');
 
});
 
Prompt({
    message: 'Are you sure you want to delete this item?'
    confirm: function(){ $.ajax({url: this.href, type: 'DELETE'}).done(function(){ window.location.reload(); }); },
    cancel: function(){ /* cancel logic here */ }
});

Available options

Prompt.defaults = {
    message: 'Are you sure',
    cancelText: 'Cancel',
    acceptText: 'Confirm',
 
    htmlClass: 'prompt_active',
    overlayClass: 'prompt_overlay',
    moduleClass: 'prompt_box',
    messageClass: 'message',
    cancelBtnClass: '',
    acceptBtnClass: '',
    inputClass: 'prompt_input',
 
    closeOnOverlayClick: false,
    closeOnEscapeKey: true,
 
    requiresUserInput: false,
    validateInput: function(inputText) {
        return inputText.length > 0;
    },
 
    confirm: null,
    cancel: null,
    context: null,
    afterRender: null
};

Readme

Keywords

Package Sidebar

Install

npm i simpleprompt

Weekly Downloads

0

Version

2.3.3

License

MIT

Last publish

Collaborators

  • dbrekalo