bootstrap bootstrap-modal.js 模态对话框 并获得传值

2019-07-07 15:10:35 浏览数 (1)

<!doctype html> <html> <head> <meta charset="utf-8"> <title>联想控股</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="css/bootstrap.css" rel="stylesheet" type="text/css"> <script src="http://code.jquery.com/jquery.js"></script> <script src="js/bootstrap.min.js"></script> </head> <body> <div class="modal fade" id="qrcode" tabindex="-1" role="dialog" aria-labelledby="information"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> <span>×</span> </button> <h4 class="modal-title">请扫描二维码,完成支付</h4> </div> <div class="modal-body" style="text-align: center"> <p id="message"></p> <img src="" alt="QRCode" id="scan"> </div> </div> </div> </div> <button id="popup" class="btn btn-primary btn-lg btn-block">我弹</button> <script>

('#popup').on('click', function(){

('#qrcode').on('show.bs.modal', function (event) { var modal = $(this); //get modal itself modal.find('.modal-body #message').text('your message'); modal.find('.modal-body #scan').attr("src", 'image src'); }); }); </script> </body> </html>

0 人点赞