diff --git a/src/main/resources/static/js/publicBoard/publicBoard.js b/src/main/resources/static/js/publicBoard/publicBoard.js index 076cad62..140c48ff 100644 --- a/src/main/resources/static/js/publicBoard/publicBoard.js +++ b/src/main/resources/static/js/publicBoard/publicBoard.js @@ -1,4 +1,13 @@ var CrossEditor + +$(function(){ + $("#dateSelectorDiv").datepicker({ + format: "yyyy-mm-dd", + language: "ko", + autoclose: true + }); +}) + $(document).on('click', '#commentSaveBtn', function (){ if(!$("#comment").val()) { alert("댓글을 입력해주세요.") @@ -20,6 +29,7 @@ $(document).on('click', '#commentSaveBtn', function (){ $("#commentDiv").append(html) const parentComment = $("#parentComment"); if(parentComment.val()){ + commentFormReset(); parentComment.val(''); $("#commentFormHome").append($("#commentForm")) } @@ -35,20 +45,16 @@ $(document).on('click', '#commentSaveBtn', function (){ } }) -$(function(){ - $("#dateSelectorDiv").datepicker({ - format: "yyyy-mm-dd", - language: "ko", - autoclose: true - }); -}) - $(document).on('click', '.childCommentBtn', function (){ const childCommentDiv = $(this).parents(".commentRow").find(".childCommentDiv") childCommentDiv.show(); $("#parentComment").val($(this).parents(".commentRow").find(".commentKey").val()); + $("#childFormRemoveBtn").show(); childCommentDiv.empty().append($("#commentForm")) }) +$(document).on('click', '#childFormRemoveBtn', function (){ + commentFormReset(); +}) $(document).on('click', '.deleteCommentBtn', function (){ const commentRow = $(this).parents(".commentRow"); const publicKey = Number(commentRow.find(".publicKey").val()); @@ -166,7 +172,14 @@ function contentCheck(formId){ return flag; } +function commentFormReset(){ + const commentForm = $("#commentForm"); + commentForm[0].reset(); + $("#childFormRemoveBtn").hide(); + $("#parentComment").val(''); + $("#commentFormHome").append(commentForm) +} + function OnInitCompleted(e){ e.editorTarget.SetBodyValue(document.getElementById("content").value); - -} +} \ No newline at end of file diff --git a/src/main/resources/templates/publicBoard/notice/noticeViewModal.html b/src/main/resources/templates/publicBoard/notice/noticeViewModal.html index accb3858..30878bba 100644 --- a/src/main/resources/templates/publicBoard/notice/noticeViewModal.html +++ b/src/main/resources/templates/publicBoard/notice/noticeViewModal.html @@ -82,6 +82,7 @@