Bootstrap에서 모달 창을 어떻게 꺼내고 동적 값을 전달합니까?
4996 단어 Front-End
Let Code tell you
<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>
$(function () {
$('#popup').on('click', function(){
$('#qrcode').modal('show');
});
$('#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');
});
});
What does it look like
If you have any questions or any bugs are found, please feel free to contact me.
Your comments and suggestions are welcome!