[Fixed]-Django ajax multiple form submission

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:

  1. replace id="comment-reply" with class="comment-reply" in your for loop

  2. replace $('#comment-reply').append(...) with $(this).prev('.comment-reply').append(...)

  3. finally replace $('#id_comment_reply').val(''); with $(this).prev('.comment-reply').val(''); and it should work

Leave a comment