title: How do I validate all form fields in a div using parsley.js?
body: <p>I have a div with a form field and a button that I would like to have parsley validate all the form fields in that div that have the proper <code>data-validate</code> attribute. I need it to work no matter how many form fields are in the div. So it needs to work on inputs, textareas, and select fields.</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;div id="parsley-div"&gt;
    &lt;div class="form-group"&gt;
      &lt;label for="city"&gt;City&lt;/label&gt;
      &lt;input id="city-test" type="text" class="form-control" data-parsley-required data-parsley-required-message="Please enter a city name."&gt;
    &lt;/div&gt;
    &lt;button class="btn btn-primary"&gt;Save Changes&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>JS:</strong></p>
  
  <pre><code>$('#parsley-div').find('button').click(function(){
    $('#parsley-div').parsley().validate();
  });
  </code></pre>
  
  <p>Unfortunately, this isn't working. I noticed it works if there is a form tag around the form fields, but I need it to be a div. I have created a JSFiddle that shows both cases: <a href="https://jsfiddle.net/8rkxzjx1/2/" rel="nofollow noreferrer">https://jsfiddle.net/8rkxzjx1/2/</a></p>
  
  <p>How can I have parsley validate all form fields with <code>data-parsley</code> attributes within a specified div? If possible, please edit the JSFiddle to show the correct implementation. Thank you.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I figured out this works, but it doesn't feel very efficient:</p>
  
  <pre><code>$('#parsley-div').find( "input, textarea, select" ).each(function (index, value) {   
    $(this).parsley().validate();
  });
  </code></pre>