Manipulating Bootstrap Alerts With jQuery - bsalert

Manipulating Bootstrap Alerts With jQuery - bsalert
File Size: 56.1 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT

Just another jQuery/Bootstrap plugin allows you to dynamically create Bootstrap alerts with various types (success, info, warning, danger) on your web applications.

How to use it:

1. Load the needed jQuery library and Bootstrap framework in the html page.

<link href="/path/to/bootstrap.min.css">
<script src="/path/to/jquery.min.js"></script>
<script src="/path/to/bootstrap.min.js"></script>

2. Load the OPTIONAL Font Awesome iconic font for the additional alert icons.

<link href="/path/to/fontawesome.min.css">

3. Download and load the jQuery bsalert's script after jQuery & Bootstrap.

<script src="jquery.bsAlert.js"></script>

4. The basic JavaScript syntax.

$(function () {
  var $container = $('#alert-container');
  $container.bsAlert('danger', 'This is a danger alert');
  $container.bsAlert('warning', 'This is a warning alert');
  $container.bsAlert('info', 'This is an info alert');
  $container.bsAlert('success', 'This is a success alert');

5. Or...

  type: 'success',
  content: 'This is a success alert'

6. More configuration options.

  type: 'success',
  content: 'This is a success alert',
  clear: true,
  dismissible: false,
  position: 'default',
  icons: {
    danger: 'fa fa-exclamation-circle',
    warning: 'fa fa-question-circle',
    info: 'fa fa-info-circle',
    success: 'fa fa-check-circle'

7. You're also able to override the global settings as these:

$.fn.bsAlert.defaults.dismissible = true;
$.fn.bsAlert.defaults.clear = false;


v1.0.0 (2019-04-28)

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