How to Create Modal Popup Form using Bootstrap?

Hi there, I am going to show, How to Create Modal Popup Form using Bootstrap.
The Modal plugin is a dialog box/popup window that is displayed on top of the current page:
Plugins can be included individually using "bootstrap.js" or "bootstrap.min.js".
1.create a index.html and copy/Paste following code.


 index.html
<!DOCTYPE html>
<html lang="en">
   <head>
      <title>Bootstrap Example</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class="container">
         <h2>Modal Popup Form using Bootstrap</h2>
         <!-- Trigger the modal with a button -->
         <button type="button" class="btn btn-warning btn-lg" data-toggle="modal" data-target="#myModal">Open Modal Popup</button>
         <!-- Modal -->
         <div class="modal fade" id="myModal" role="dialog">
            <div class="modal-dialog">
               <!-- Modal content-->
               <div class="modal-content">
                  <div class="modal-header">
                     <button type="button" class="close" data-dismiss="modal">&times;</button>
                     <h4 class="modal-title">Signup form</h4>
                  </div>
                  <div class="modal-body">
                     <div class="container">
                        <form class="form-horizontal" action="#" enctype="application/x-www-form-urlencoded" id="signup_form" method="POST" accept-charset="utf-8" role="form" novalidate="true">
                           <div class="form-group">
                              <label class="control-label col-sm-2" for="username">Username:</label>
                              <div class="col-sm-4">
                                 <input type="text" class="form-control" id="username" placeholder="Enter Username" name="username">
                              </div>
                           </div>
                           <div class="form-group">
                              <label class="control-label col-sm-2" for="email">Email:</label>
                              <div class="col-sm-4">
                                 <input type="email" class="form-control" id="email" placeholder="Enter email" name="email">
                              </div>
                           </div>
                           <div class="form-group">
                              <label class="control-label col-sm-2" for="password">Password:</label>
                              <div class="col-sm-4">          
                                 <input type="password" class="form-control" id="password" placeholder="Enter password" name="password">
                              </div>
                           </div>
                           <div class="form-group">
                              <div class="col-sm-offset-2 col-sm-10">
                                 <input type="submit" class="btn btn-default" name="signup" value="Signup">
                              </div>
                           </div>
                           <div class="form-group col-sm-offset-2 col-sm-10" id="message" style="display:none;">
                           </div>
                        </form>
                     </div>
                  </div>
                  <div class="modal-footer">
                     <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </body>
</html> 
 

Comments