how to use bootstrap to style javascript alert box code example

Example 1: 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 2: bootstrap Alerts Additional content

Alerts can also contain additional HTML elements like headings, paragraphs 
and dividers.

<div class="alert alert-success" role="alert">
  <h4 class="alert-heading">Well done!</h4>
  <p>Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.</p>
  <hr>
  <p class="mb-0">Whenever you need to, be sure to use margin utilities to keep things nice and tidy.</p>
</div>

Tags:

Java Example