Bootstrap Tutorial - Show alert block with fade in








The following code shows how to show alert block with fade in.

Example

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.10.1.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0-wip/css/bootstrap.min.css">
<script type='text/javascript'
  src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0-wip/js/bootstrap.min.js"></script>
<script type='text/javascript'>
$(window).load(function(){<!--  w w w.ja v  a2 s.co m-->
    $("#click").click(function() {
        $("#success").html('Hello World!').removeClass("hide").hide().fadeIn("slow");
    });
});
</script>
</head>
<body>
  <div id="success" class="alert alert-success hide"></div>
  <br>
  <button type="submit" id="click">Click</button>
</body>
</html>

Click to view the demo