title: How to get dynamic text with one form
body: <p>I have a comment reply system and when I try to reply to a comment, the first reply works fine. </p>
  
  <p>For any subsequent replies, I can get comment id and article id to submit but I can't get the reply text value.</p>
  
  <p>How can I make this work based on the Razor code below for all replies every time?</p>
  
  <pre><code>&lt;h4&gt;Comments&lt;/h4&gt;
  &lt;hr /&gt;
  @foreach (var item in Model.Comments.ToList())
  {
      &lt;!-- Single Comment --&gt;
      &lt;div class="media mb-4"&gt;
          &lt;img style="height:40px; width:40px;" class="d-flex mr-3 rounded-circle" src="@item.User.Photo" alt="@item.User.FullName"&gt;
          &lt;div class="media-body" style="width:400px;"&gt;
              &lt;h5 class="mt-0"&gt;@item.User.UserName&lt;/h5&gt;
              &lt;div&gt;
                  &lt;p style="word-break:break-all"&gt;
                      @item.Paragraph
                      @if (Convert.ToInt32(Session["UserId"]) == item.UserId)
                  {
                          &lt;a class="btn btn-danger" href="/Home/DeleteComment/@item.CommentId"&gt;
                              Delete
                          &lt;/a&gt;
  
                          &lt;div style="height:10px;"&gt; &lt;a id="post_id_1" name='comment1' class="showReply" href="javascript: void(0)"&gt;Reply&lt;/a&gt;&lt;/div&gt;
                      }
                  &lt;/p&gt;
                  &lt;p style="font-size:small"&gt;&lt;b&gt;Yorum Tarihi:&lt;/b&gt;@String.Format("{0: d MMMM yyyy}", item.Date)&lt;/p&gt;
              &lt;/div&gt;
              &lt;!--Reply Form--&gt;
              &lt;div id="replymsgbox" style="display: none;"&gt;
                  &lt;form id="frmComment" novalidate="novalidate" method="POST" name="frmComment"&gt;
                      &lt;div&gt;
                          &lt;textarea id="replytext" class="" name="comment1[text]"&gt;&lt;/textarea&gt;
                          &lt;div id="error_text"&gt; &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div&gt;
                          &lt;input id="@item.CommentId" class="reply" type="submit" value="Cevapla" name="Submit"&gt;
                      &lt;/div&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
  
  
              @foreach (var reply in Model.ReplyComments.Where(x =&gt; x.CommentId == item.CommentId).ToList())
              {
                  &lt;div class="media mt-4"&gt;
                      &lt;img style="height:40px; width:40px;" class="d-flex mr-3 rounded-circle" src="@item.User.Photo" alt="@item.User.FullName"&gt;
                      &lt;div class="media-body"&gt;
                          &lt;h5 class="mt-0"&gt;@reply.User.UserName&lt;/h5&gt;
                          &lt;p&gt;@reply.Paragraph&lt;/p&gt;
                          @if (Convert.ToInt32(Session["UserId"]) == item.UserId)
                          {
                              &lt;a class="btn btn-danger" href="/Home/DeleteReply/@reply.ReplyCommentId"&gt;
                                  Sil
                              &lt;/a&gt;
                          }
                      &lt;/div&gt;
                  &lt;/div&gt;
              }
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>and this is my javascript code</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  $(document).ready(function () {
  
      $('a.showReply').on("click", function (e) {
          $(this).parent("div").parent("div").next("div").slideToggle();
      });
  
      $(".reply").click(function (e) {
  
          e.preventDefault();
          var r_comment = $("#replytext").val();
          var r_commentid = parseInt($(this).attr("id"));
          $.ajax({
               url: '/Home/ReplyComment/',
               data: { replycomment: r_comment, articleid:@Model.ArticleId, commentid: r_commentid },
              type: 'POST',
              dataType: 'json',
              success: function (data) {
                  alert("Cevap gönderildi");
                  window.location.reload();
  
              }
          });
  
  });
  })
  </code></pre>