"Example of Bootstrap 3 Modal Events"
Bootstrap 3.3.0 Snippet by selvasekhar

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Example of Bootstrap 3 Modal Events</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <script type="text/javascript"> $(document).ready(function(){ $("#myModal").on('show.bs.modal', function(event){ var button = $(event.relatedTarget); // Button that triggered the modal var titleData = button.data('title'); // Extract value from data-* attributes $(this).find('.modal-title').text(titleData + ' Form'); }); }); </script> <style type="text/css"> .bs-example{ margin: 0% auto; } </style> </head> <body> <body class="modal-open"> <div class="bs-example"> <!-- Button HTML (to Trigger Modal) --> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal" data-title="Feedback">Feedback</button> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal" data-title="Report Error">Report Error</button> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal" data-title="Contact Us">Contact Us</button> <!-- Modal HTML --> <div id="myModal" class="modal fade in" style="display: block; padding-left: 17px;"> <div class="modal-dialog" style=" position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); /* width: 100%; */ height: 50%; z-index: 999; z-index: 999; background-color: rgba(0, 0, 0, 0.48); "> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">Feedback Form</h4> </div> <div class="modal-body"> <form role="form"> <div class="form-group"> <label for="recipient-name" class="control-label">Email:</label> <input type="text" class="form-control" id="recipient-name"> </div> <div class="form-group"> <label for="message-text" class="control-label">Message:</label> <textarea class="form-control" id="message-text"></textarea> </div> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> <button type="button" class="btn btn-primary">Send</button> </div> </div> </div> </div> </div> <div class="modal-backdrop fade in"></div></body> </body> </html>

Related: See More


Questions / Comments: