Bootstrap provided interactive modal and alert classes now i’m going to combine both alert and modal. Modal creates popup and dialog like experience and alerts are used to display notification messages. There are different types of indication colors for alert. Lets see how to use alert along with modal popup. Actually it is good idea in most cases it is very useful in real time senario. When ever we click on submit button it displays a modal popup along with alert message.  If you want to close message simply click on the right side close icon of alert message.
<!DOCTYPE html>
<html lang="en">
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Bootstrap Alert and Modal Example</title>
  <link href=""
<body style="margin-top: 70px;">
  <header class="container">
  <h4>Alert Along With Modal Dialog Box</h4>
    <section class="container">
      <div class="alert alert-warning collapse" id="sentAlert">
        <a href="#" data-dismiss="alert" class="close">&times;</a>
        <p>This is warning message</p>
      <div class="tab-content">
        <div class="well" id="formTab">
          <div class="row">
            <form class="form-horizontal" id="contactForm">
              <div class="form-group">
                <label for="emailInput" class="control-label col-md-2">Email</label>
                <div class="col-md-10">
                  <div class="input-group">
                    <span class="input-group-addon">@</span>
                    <input type="email" name="emailInput" class="form-control"
             placeholder="e.g. Your Email" />
     <div class="form-group">
                <div class="col-md-10 col-md-offset-2">
                  <input type="submit" value="Submit" class="btn btn-success"/>
  <div class="modal" id="sentDialog" tabindex="-1">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <a href="#" class="close" data-dismiss="modal">&times;</a>
          <h4>Thanks for clicking</h4>
        <div class="modal-body">
          <p>This is modal body</p>
        <div class="modal-footer">
          <button class="btn btn-success" data-dismiss="modal">Close</button>
  <script src=""> </script>
  <script src=""> </script> 
  <script >
  (function () {
  "use strict";
  var $sentDialog = $("#sentDialog");

  $("#contactForm").on("submit", function () {
    return false;

  var $sentAlert = $("#sentAlert");

  $sentDialog.on("", function () {

  $sentAlert.on("", function () {
    return false;


Post a Comment