해당 댓글 창에 아래와 같이 입력하시면 됩니다.
<load target="../../../../tpl/filter/delete_comment.xml" /> <!--<button class="modal-open">Open</button>--> <div class="modal delcomment"> <div class="modal-box"> <div class="header"> 댓글 삭제 <div class="modal-close">닫기</div> </div> <div class="modal-body"> <b>{$comment->getNickName()}</b> <br> <div class="comment"> {htmlspecialchars_decode($comment->getSummary(100))} </div> <div class="date">{$comment->getRegdate('Y.m.d H:i')}</div> </div> <div class="modal-foot"> <form action="./" method="get" onsubmit="return procFilter(this, delete_comment)"> <input type="hidden" name="mid" value="{$mid}" /> <input type="hidden" name="page" value="{$page}" /> <input type="hidden" name="document_srl" value="{$comment->get('document_srl')}" /> <input type="hidden" name="comment_srl" value="{$comment->get('comment_srl')}" /> <input type="submit" value="{$lang->cmd_delete}" /> <div class="modal-close">취소</div> </form> </div> </div> </div>
코드 활용은 적당히;;
위 방법은 모달창으로 만들었었는데
두번째 방법은 자바스크립트 확인창을 활용하는 방법입니다.
HTML
<button class="btn-delete" onclick="commentDelete(this);">[삭제확인]</button> <form action="./" method="get" onsubmit="return procFilter(this, delete_comment)" name="formCommentDel"> <input type="hidden" name="mid" value="{$mid}" /> <input type="hidden" name="page" value="{$page}" /> <input type="hidden" name="document_srl" value="{$comment->get('document_srl')}" /> <input type="hidden" name="comment_srl" value="{$comment->get('comment_srl')}" /> <input type="submit" value="삭제" /> </form> <load target="../../../../tpl/filter/delete_comment.xml" />
SCRIPT
// 코멘트 삭제 function commentDelete(el){ if (confirm("이 댓글을 삭제하시겠습니까?")) { console.log("예를 누르셨습니다."); const formCommentDel = $(el).next("form[name='formCommentDel']"); console.log(formCommentDel); formCommentDel.submit(); } else { console.log("아니오을 누르셨습니다."); } }