jquery 모달 modal 띄우고 닫기
jquery 모달 modal 띄우고 닫기
<button type="button" id="btnOpen">모달오픈</button>
<div id="popupModal">
<table class="" id="tempList">
<colgroup>
<col width="">
<col width="">
<col width="">
</colgroup>
<thead>
<tr>
<th class="">컬럼헤더0</th>
<th class="">컬럼헤더1</th>
</tr>
</thead>
<tbody>
<tr>
<td>컬럼0</td>
<td>컬럼1</td>
</tr>
</tbody>
</table>
<div class="footer">
<a href="#" id="btnClose" data-dismiss="modal"><spring:message code='system.close'/></a>
</div>
</div>
//모달 띄우기
$("#btnOpen").click(function(){
$("#popupModal").modal('show');
});
//테이블 row를 클릭했을때 값을 처리하고 modal를 닫는다.
$("#tempList tbody").on("click", "tr", function(){
alert( $(this).find("td:eq(0)").text() );
$("#btnClose").trigger('click');
});
여기서 <spring:message code='system.close'/> 는 메세지 프로퍼티 파일의 내용입니다.
즉, /WEB-INF/messages 폴더에 파일이 존재합니다. 위치는 설정파일에서 변경할 수 있습니다.
/WEB-INF/messages/message.properties 파일을 열어보면
system.close=닫기
이렇게 되어 있습니다.