1👍
✅
It is showing all of them because you ask all the elements with the class “comment-replyform” to be shown, instead you have to focus on the one inside the clicked element.
to do so, replace:
$(".comment-replyform").show();
by:
$(this).next().next(".comment-replyform").show();;
for the second part of your question, it is because you should only have one element with a specific ID, so:
-
replace
id="comment-reply"
withclass="comment-reply"
in your for loop -
replace
$('#comment-reply').append(...)
with$(this).prev('.comment-reply').append(...)
-
finally replace
$('#id_comment_reply').val('');
with$(this).prev('.comment-reply').val('');
and it should work
Source:stackexchange.com