Tiny & Customizable Confirmation Dialog Plugin - jQuery confirm.js

File Size: 25.9 KB
Views Total: 501
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Tiny & Customizable Confirmation Dialog Plugin - jQuery confirm.js

A simple, elegant jQuery confirmation dialog plugin that allows you to present a one-off confirm dialog box on any screen and gives users an opportunity to make a decision.

Useful to ask users if they are sure they want to leave your site, submit a form or maybe something else.

How to use it:

1. Include the stylesheet confirm.css and JavaScript confirm.js on the page.

<!-- jQuery Is Required -->
<script src="/path/to/cdn/jquery.min.js"></script>

<!-- Confirm Dialog Files -->
<link href="/path/to/css/confirm.css" rel="stylesheet">
<script src="/path/to/js/confirm.js"></script>

2. Create a basic confirmation dialog and trigger functions after the user makes a decision.

new Confirm({
    title: 'Confirm Title',
    message: 'Are you sure to continue?',
    confirm:function (){
      // doSomthing
    },
    cancel:function (){
      // doSomthing
    }
});

3. Change the theme to 'Dark'.

new Confirm({
    title: 'Confirm Title',
    message: 'Are you sure to continue?',
    confirm:function (){
      // doSomthing
    },
    cancel:function (){
      // doSomthing
    },
    theme:'dark',
});

4. Customize the Confirm & Cancel buttons.

new Confirm({
    title: 'Confirm Title',
    message: 'Are you sure to continue?',
    confirm: function (){
      // doSomthing
    },
    cancel: function (){
      // doSomthing
    },
    confirmBtn: 'yes',
    cancelBtn: 'no',
});

5. RTL mode is supported as well.

new Confirm({
    direction:'drtl',
    confirmBtn:'بله',
    cancelBtn: 'خیر',
    title:'تایید',
    message:'آیا از ادامه کار مطئن هستید؟',
    confirm: function (){
      // doSomthing
    },
    cancel: function (){
      // doSomthing
    },
});

This awesome jQuery plugin is developed by hamid-hpd. For more Advanced Usages, please check the demo page or visit the official website.