bootstrap closable alert code example

Example 1: bootstrap flash message

<div class="alert alert-success 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>

Example 2: bootstrap Alerts Additional content Dismissing

<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>

Enable dismissal of an alert via JavaScript:

$('.alert').alert()
$().alert('close')
$().alert()
$().alert('dispose')

Events

close.bs.alert
closed.bs.alert

Tags:

Java Example