All Projects → claviska → Jquery Alertable

claviska / Jquery Alertable

Licence: mit
Minimal alert and confirmation alternatives.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Jquery Alertable

Smalltalk
Promise-based Alert, Confirm and Prompt replacement
Stars: ✭ 76 (+100%)
Mutual labels:  prompt, confirm
react-st-modal
Simple and flexible modal dialog component for React JS
Stars: ✭ 41 (+7.89%)
Mutual labels:  prompt, confirm
Vue Simple Alert
Simple alert(), confirm(), prompt() for Vue.js
Stars: ✭ 93 (+144.74%)
Mutual labels:  prompt, confirm
Alertifyjs
A javascript framework for developing pretty browser dialogs and notifications.
Stars: ✭ 1,922 (+4957.89%)
Mutual labels:  prompt, confirm
mobile-message
基于移动端的弹窗组件,默认提供info、success、warning、error、alert、confirm、multiple、vertical、bottomSheet、prompt,可自定义弹窗。它可以包含任何Html内容可以自定义弹窗的样式,也可以加入自定以的弹窗动画。
Stars: ✭ 13 (-65.79%)
Mutual labels:  prompt, confirm
Jalert
jQuery alert/modal/lightbox plugin
Stars: ✭ 73 (+92.11%)
Mutual labels:  alerts, jquery
Sweetalert2
A beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes. Zero dependencies.
Stars: ✭ 13,929 (+36555.26%)
Mutual labels:  prompt, confirm
Jquery Confirm
A multipurpose plugin for alert, confirm & dialog, with extended features.
Stars: ✭ 1,776 (+4573.68%)
Mutual labels:  confirm, jquery
enquirer
Stylish, intuitive and user-friendly prompts, for Node.js. Used by eslint, webpack, yarn, pm2, pnpm, RedwoodJS, FactorJS, salesforce, Cypress, Google Lighthouse, Generate, tencent cloudbase, lint-staged, gluegun, hygen, hardhat, AWS Amplify, GitHub Actions Toolkit, @airbnb/nimbus, and many others! Please follow Enquirer's author: https://github.…
Stars: ✭ 6,523 (+17065.79%)
Mutual labels:  prompt, confirm
jquery.dialog.js
A lightweight replacement for the browser's default dialog boxes.
Stars: ✭ 17 (-55.26%)
Mutual labels:  prompt, confirm
ax5ui-dialog
Javascript UI Component - Dialog - JavaScript Dialog / Bootstrap Dialog
Stars: ✭ 29 (-23.68%)
Mutual labels:  prompt, confirm
Vuejs Dialog
A lightweight, promise based alert, prompt and confirm dialog
Stars: ✭ 327 (+760.53%)
Mutual labels:  prompt, confirm
Razor.SweetAlert2
A Razor class library for interacting with SweetAlert2
Stars: ✭ 98 (+157.89%)
Mutual labels:  prompt, confirm
Notie
🔔 a clean and simple notification, input, and selection suite for javascript, with no dependencies
Stars: ✭ 6,170 (+16136.84%)
Mutual labels:  prompt, confirm
Jquery.lazy
A lightweight, fast, feature-rich, powerful and highly configurable delayed content, image and background lazy loading plugin for jQuery & Zepto.
Stars: ✭ 965 (+2439.47%)
Mutual labels:  jquery
Bootstrap 4 Autocomplete
A simple autocomplete/typeahead for Bootstrap 4 and jQuery
Stars: ✭ 36 (-5.26%)
Mutual labels:  jquery
Price Tracker
Live and historical prices for fiat currencies, crypto currencies and gold/silver over REST and WebSocket APIs, using Redis as storage. Node.js, jQuery, Bootstrap
Stars: ✭ 32 (-15.79%)
Mutual labels:  jquery
Gridstrap.js
gridstrap.js is a jQuery plugin designed to take Bootstrap's CSS grid system and turn it into a managed draggable and resizeable grid while truely maintaining its responsive behaviour.
Stars: ✭ 32 (-15.79%)
Mutual labels:  jquery
Bootstrap Star Rating
A simple yet powerful JQuery star rating plugin with fractional rating support.
Stars: ✭ 985 (+2492.11%)
Mutual labels:  jquery
Ecommerce
We're going to take you step-by-step to build a modern, fully open-source, eCommerce web application using Python, Django, Bootstrap, Javascript, and more.
Stars: ✭ 980 (+2478.95%)
Mutual labels:  jquery

jquery.alertable.js - Minimal alert, confirm, and prompt replacements.

Developed by Cory LaViska for A Beautiful Site, LLC

Licensed under the MIT license: http://opensource.org/licenses/MIT

Overview:

This plugin provides a minimal, lightweight, and customizable alternative to window.alert(), window.confirm(), and window.prompt(). It's flexible enough to mold to your application's existing stylesheet and markup.

Features:

  • Simple syntax:
    • $.alertable.alert('Howdy!')
    • $.alertable.confirm('You sure?').then(function() { ... })
    • $.alertable.prompt('How many?').then(function(data) { ... })
  • Minimal default styles; easy to customize or write your own.
  • Show/hide hooks for adding custom animation (works well with Velocity.js).
  • Prevents focus from leaving the modal.
  • Returns promise-compatible (jQuery deferred) for ok/cancel actions.
  • Compact! (about 180 lines)

Demo

A quick demo can be found on CodePen: http://codepen.io/claviska/pen/mPNWxy

A local demo can be found in example.html.

Installing

Include the minified version of this plugin in your project or install via NPM:

npm install --save @claviska/jquery-alertable

Using the plugin

Example alerts:

// Basic example
$.alertable.alert('Howdy!');

// Example with action when the modal is dismissed
$.alertable.alert('Howdy!').always(function() {
  // Modal was dismissed
});

Example confirmations:

// Basic example
$.alertable.confirm('You sure?').then(function() {
  // OK was selected
});

// Example with then/always
$.alertable.confirm('You sure?').then(function() {
  // OK was selected
}, function() {
  // Cancel was selected
}).always(function() {
  // Modal was dismissed
});

Example prompts:

// Basic example
$.alertable.prompt('How many?').then(function(data) {
  // Prompt was submitted
});

// Example with then/always
$.alertable.prompt('How many?').then(function(data) {
  // Prompt was submitted
}, function() {
  // Prompt was canceled
}).always(function() {
  // Modal was dismissed
});

Important: Unlike window.alert(), window.confirm(), and window.prompt(), using this plugin will not cause execution of the script to stop while the modal is open. This behavior is not possible to emulate with a plugin nor is it desirable in modern web applications.

Options

Pass options as the second argument of any method:

$.alertable.alert('Howdy!', {
  optionName: optionValue,
  ...
});

$.alertable.confirm('You sure?', {
  optionName: optionValue,
  ...
});

$.alertable.prompt('How many?', {
  optionName: optionValue,
  ...
});

Available options:

  • container: The container to append the modal to. Defaults to 'body'.

  • html: Whether or not your message contains HTML. Defaults to false.

  • cancelButton: HTML to use for the reject button. Default value:

<button class="alertable-cancel" type="button">Cancel</button>
  • okButton: HTML to use for the resolve button. Default value:
<button class="alertable-ok" type="submit">OK</button>
  • overlay: HTML to use for the overlay. Default value:
<div class="alertable-overlay"></div>
  • prompt: HTML to use for the prompt body. All inputs contained in this HTML will be serialized and returned when the prompt is submitted. Default value:
<input class="alertable-input" type="text" name="value">
  • modal: HTML to use for the modal. Default value:
<form class="alertable">
  <div class="alertable-message"></div>
  <div class="alertable-prompt"></div>
  <div class="alertable-buttons"></div>
</form>
  • hide: Function for hiding the modal and overlay. Use this.modal and this.overlay to reference the modal and overlay elements. Default value:
$(this.modal).add(this.overlay).fadeOut(100);
  • show: Function for showing the modal and overlay. Use this.modal and this.overlay to reference the modal and overlay elements. Default value:
$(this.modal).add(this.overlay).fadeIn(100);

You may also update the default options before calling either method:

$.alertable.defaults.optionName = yourValue;

Promises

All methods return a promise-compatible (jQuery-deferred) object. As a result, you can use any of the supported chainable methods. However, the examples above demonstrate the most appropriate ones to use.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].