Y
Y
Yury Bondaruk2022-03-18 18:05:38
Web development
Yury Bondaruk, 2022-03-18 18:05:38

What is the best way to implement the ability to show and hide the "reply" form in the comments?

There is a "reply" button in the comment form, which, when clicked, should toggle the "d-none" bootstrap class on or off.
62349f0220690415969993.jpeg
Each "reply" button has an onClick and id binding (for example, #reply-on-comment-5), as well as the response forms themselves with an id (#form-to-reply-on-7)
How can I better implement receiving id of the comment that should be answered if I use the following function:

function myFunc() {
            var para = document.getElementById("form-to-reply-on-COMMENT_ID");
            para.classList.toggle("d-none");
}


Tried using Blade template engine, but using {{$comment->id}} static id of one of the comments is displayed.

Tell me how to be.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2022-03-18
@drnkwtr

It is possible without js at all: https://jsfiddle.net/dofzgt9v/1/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question