diff options
Diffstat (limited to 'static/js')
-rw-r--r-- | static/js/controllers/replies_controller.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/static/js/controllers/replies_controller.js b/static/js/controllers/replies_controller.js index af0f2ec..5e67057 100644 --- a/static/js/controllers/replies_controller.js +++ b/static/js/controllers/replies_controller.js @@ -22,17 +22,19 @@ export class RepliesController extends BaseController { showReplyForm(event) { const replies_section = event.target.parentElement.parentElement.childNodes[3]; + const form = replies_section.querySelector(".reply-form"); - if(replies_section.querySelector(".reply-form") == null) + if(form == null) replies_section.appendChild(this.reply_form); - /*else hide*/ + else + form.remove(); } showReplies(event) { /* The div to contain the comment's replies. From the element id we can get the comment's id. */ const replies_section = event.target.parentElement.parentElement.childNodes[3]; - const comment_id = /\d/.exec(replies_section.id)[0] + const comment_id = /\d/.exec(replies_section.id)[0]; console.log("You're in showReplies()"); } |