how to make bootstrap alert disappear automatically code example

Example 1: 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

Example 2: bootstrap dismissible alert not working

<div class="alert alert-warning alert-dismissible" role="alert">
  <span type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></span>
  <strong>Warning!</strong> Still on beta stage.
</div>