위와 같이 '6'이란 숫자를 전달하고 싶을때 처리하는 절차입니다.
웹의 어떤 요소를 클릭했을때 모달창을 띄워주고 싶을때 하는 방식으로.....
사용하는 방법입니다.
기본적인 정보 html 부트스트랩 소스
<div class="container">
<!-- 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">×</button>
<h4 class="modal-title">작품정보 상세정보</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
<input type="text" name="test" id="test" value=""/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
</div>
</div>
</div>
</div>
</div>
눌렀을때 동작을 설정해 준다.
<script>
$(document).on("click", "#OrderDialog", function () {
var num = $(this).data('id');
$(".modal-body #bookId").val( num );
// As pointed out in comments,
// it is superfluous to have to manually call the modal.
$('#myModal').modal('show');
});
</script>
실행하니 위의 결과물이 잘 나옵니다.
오늘도 즐거운 코딩~
'IT tech Coding > Bootstrap' 카테고리의 다른 글
Bootstrap 5: 새로운 시대의 웹 디자인 프레임워크 (0) | 2023.10.08 |
---|---|
bootstrap modal창 위에 또다른 modal창 띄우는 코드 (0) | 2023.03.29 |
modal창 button 중복으로 눌리는 현상, 이거 해결하는데 정말 장난 아님 (0) | 2023.03.09 |
[bootstrap] 화면 상단 장바구니 결재 등 구성하는 소스코드 php html (0) | 2022.11.03 |
[bootstrap] groupbox처럼 구현이 가능할까? (0) | 2022.01.10 |