대댓글 폼 제자리 수정.

강석 최 2022-12-05 16:53:29 +09:00
parent e0ebe503fb
commit d830376765
2 changed files with 24 additions and 10 deletions

View File

@ -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);
}
}

View File

@ -82,6 +82,7 @@
</div>
<div class="col-auto m-auto">
<input type="button" class="btn btn-sm btn-primary" id="commentSaveBtn" value="작성">
<input type="button" class="btn btn-sm btn-warning" id="childFormRemoveBtn" value="취소" style="display: none">
</div>
</div>
</form>