bootstrap alert dismiss not working code example
Example 1: bootstrap alerts
<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">×</span>
</button>
</div>
Example 2: 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">×</span>
</button>
</div>
Example 3: my bootstrap alerts code is not closing
<!-- jquery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<!-- bootstrap -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
</button>
<strong>Yay</strong> Your email has been added!
</div>
Example 4: 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">×</span>
</button>
</div>
Trigger via javascript:
$(".alert").alert();
Example 5: 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">×</span></span>
<strong>Warning!</strong> Still on beta stage.
</div>