title: How to specify minlength in jquery?
body: <p>If the status value is completed then comment field is required is working good.But the problem is, I want to specify comment field is required for minimum of 50 character.</p>
  
  <p><strong>The Below code:</strong> index.php</p>
  
  <pre><code>   &lt;!-- Select Basic --&gt;
      &lt;div class="form-group"&gt;
        &lt;label class="col-md-4 control-label" for="selectbasic"&gt;Status&lt;/label&gt;
        &lt;div class="col-md-4"&gt;
          &lt;select id="status" name="status[]" class="form-control" &gt;
            &lt;option value="Pending"&gt;Pending&lt;/option&gt;
            &lt;option value="Work in process"&gt;Work in process&lt;/option&gt;
            &lt;option value="Completed"&gt;Completed&lt;/option&gt;
          &lt;/select&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;!-- Text input--&gt;
      &lt;div class="form-group"&gt;
        &lt;label class="col-md-4 control-label" for="textinput"&gt;Comment&lt;/label&gt;  
        &lt;div class="col-md-4"&gt;
        &lt;input id="commentss" name="comment[]" type="text" placeholder="" class="form-control input-md" /&gt; 
        &lt;/div&gt;
      &lt;/div&gt;
  &lt;div class="col-md-8 col-sm-12 col-24"&gt;
      &lt;div class="input_fields" style="color:black"&gt;
           &lt;button class="add_field btn " onclick="incrementValue()" &gt;Add More&lt;/button&gt;
           &lt;div&gt;
           &lt;input type="text" name="mytextt[]" hidden="" &gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
   $(document).ready(function () {
          $("#status").click(function () {
  
              if ($("#status").val() == "Completed") {
                  $("#commentss").attr("required", "required");
              }
              else
                $("#commentss").attr("required", false);
          });
  });
  &lt;/script&gt;
  </code></pre>