bootstrap alert dialog box code example

Example 1: open bootstrap modal with javascript

$("#myModal").modal()

Example 2: bootstrap alert box

Alerts in Bootstrap:
--------------------------------
Alert classes you can use to check
.alert-primary
.alert-secondary
.alert-success
.alert-danger
.alert-warning
.alert-info
.alert-light
.alert-dark

Simple alert:
-------------
<div class="alert alert-primary" role="alert">
  This is a primary alert—check it out!
</div>

Alert with close button and decriptive feature:
------------------------------------------------
<div class="alert alert-warning alert-dismissible fade show" role="alert">
  <strong>Holy guacamole!</strong> You should check in on some of those fields below.
  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
    <span aria-hidden="true">&times;</span>
  </button>
</div>

Trigger via javascript:
$(".alert").alert();

Example 3: bootstrap popup alert

<div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
  <div class="toast-header">
    <img src="..." class="rounded mr-2" alt="...">
    <strong class="mr-auto">Bootstrap</strong>
    <small>11 mins ago</small>
    <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
      <span aria-hidden="true">×</span>
    </button>
  </div>
  <div class="toast-body">
    Hello, world! This is a toast message.
  </div>
</div>

Example 4: alert modal

npm i bootbox

Tags:

Css Example