Bootstrap Tutorial - Create message modal dialog








The following code shows how to create message modal dialog.

Example

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.10.1.js'></script>
<script type='text/javascript'
  src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-modal.js"></script>
<link rel="stylesheet" type="text/css"
  href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css">
<script type='text/javascript'>
$(window).load(function(){<!--from  w  w w .  ja  v a 2 s .  c om-->
   $('#myModal2').modal('show');
});
</script>
</head>
<body>
  <a href="#myModal2" role="button" class="btn btn-warning"
    data-toggle="modal">Confirm</a>
  <div id="myModal2" class="modal hide fade" tabindex="-1" role="dialog"
    aria-labelledby="myModalLabel2" aria-hidden="true">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal"
        aria-hidden="true">&times;</button>
      <h3 id="myModalLabel2">Alert Header</h3>
    </div>
    <div class="modal-body">
      <p>Body goes here...</p>
    </div>
    <div class="modal-footer">
      <button data-dismiss="modal" class="btn green">OK</button>
    </div>
  </div>
</body>
</html>

Click to view the demo