screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Bootstrap 5 Modal Example</title> <!-- Include Bootstrap CSS --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet"> </head> <body> <!-- Button to trigger the modal --> <h3>Bootstrap Modal Pass data Dynamically </h3> <button type="button" class="btn btn-primary" data-bs-toggle="modal" id='open-modal' data-bs-target="#myModal">Open Modal</button> <!-- Modal --> <div class="modal fade" id="myModal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="myModalLabel"></h4> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <p></p> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> </div> </div> </div> </div> <!-- Bootstrap and jQuery JavaScript --> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js"></script> <script> $(document).ready(function () { $('#open-modal').on('click', function () { const title = 'Bootstrap Modal Pass Data Dynamically'; const paragarph = 'This Text is Dynamically ' + new Date(); $('.modal-title').text(title); $('.modal-body p').text(paragarph); }); }); </script> </body> </html>