title: Jquery work with multiple form
body: <p>I am generating multiple forms using php code in a php page where each form has a textarea input and a button. Once a value will be entered the button will be enabled and its empty button will be disable. I found hard to trigger textarea and button using their id as php code is generating unknown number of forms in different type. Is there any other way to trigger form and it's button and textarea input to be able to disable/enable button?</p>
  
  <pre><code>&lt;form method="POST" name="comment" class="setCommentBox"&gt;
      &lt;div class="form-group"&gt;
          &lt;div class="bs-example"&gt;
              &lt;textarea class="form-control" rows="2" name="txtcomment" maxlength="140" style="resize: none;" placeholder="Compose comment"&gt;&lt;/textarea&gt;
                  &lt;input name="txtHiddenMusicPostID" value="37" type="hidden"&gt;
              &lt;/div&gt;
              &lt;/div&gt;
          &lt;button type="submit" class="btn btn-success pull-right" name="post-Comment" value="post-Comment" disabled="disabled"&gt;
          &lt;/button&gt;
  &lt;/form&gt;
      &lt;form method="POST" name="comment" class="setCommentBox"&gt;
      &lt;div class="form-group"&gt;
          &lt;div class="bs-example"&gt;
              &lt;textarea class="form-control" rows="2" name="txtcomment" maxlength="140" style="resize: none;" placeholder="Compose comment"&gt;&lt;/textarea&gt;
                  &lt;input name="txtHiddenMusicPostID" value="37" type="hidden"&gt;
              &lt;/div&gt;
              &lt;/div&gt;
          &lt;button type="submit" class="btn btn-success pull-right" name="post-Comment" value="post-Comment" disabled="disabled"&gt;
          &lt;/button&gt;
  &lt;/form&gt;
  &lt;form method="POST" name="comment" class="setCommentBox"&gt;
      &lt;div class="form-group"&gt;
          &lt;div class="bs-example"&gt;
              &lt;textarea class="form-control" rows="2" name="txtcomment" maxlength="140" style="resize: none;" placeholder="Compose comment"&gt;&lt;/textarea&gt;
                  &lt;input name="txtHiddenMusicPostID" value="37" type="hidden"&gt;
              &lt;/div&gt;
              &lt;/div&gt;
          &lt;button type="submit" class="btn btn-success pull-right" name="post-Comment" value="post-Comment" disabled="disabled"&gt;
          &lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>jqueryCode:</p>
  
  <pre><code>            jQuery("document").ready(function ($) {
              var $register = $("button[name='post-Comment']");
              //$register.attr('disabled', true);
              $("textarea[name='txtcomment']").keyup(function () {
                  var trigger = false;
                  $("textarea[name='txtcomment']").each(function() {
                      if ($(this).val() === '') {
                          trigger = true;
                      }
                  });
                  if (trigger) {
                      $register.attr('disabled', 'disabled');
                  } else {
                      $register.removeAttr('disabled');
                  }
              });
          });
  </code></pre>