title: jQuery validation - Cannot read property 'settings' of undefined on dynamic forms
body: <p>I am using Wordpress, but this question is actually a Jquery validation.</p>
  
  <p>HTML section ( There is repetition of this section with different ids  ) </p>
  
  <pre><code>&lt;div class="product-col" id="row-4016"&gt;
    &lt;div class="sync-prod-image"&gt;&lt;img src="image1.jpg"&gt;&lt;/div&gt;
    &lt;div class="product-meta"&gt;
      &lt;div class="poster-table" border="0" width="100%"&gt;
        &lt;form action="" id="meta-form-43825" class="poster-meta-form" novalidate="novalidate"&gt;
          &lt;div class="size-11x17 poster-tr meta-4018 meta-row-wrap"&gt;
            &lt;div width="15%"&gt;&lt;span&gt;11x17&lt;input type="hidden" name="base_amount" id="base_amount-4018" value="8"&gt;&lt;/span&gt;&lt;/div&gt;
            &lt;input type="hidden" value="43826" class="meta_price_id" id="poster_price-4018" name="poster_price-4018"&gt;
            &lt;div width="15%"&gt;&lt;span&gt;8.00&lt;input type="hidden" class="base-price" name="base_price" id="base_price-4018" value="8.00"&gt;&lt;/span&gt;&lt;/div&gt;
            &lt;div width="15%"&gt;&lt;span&gt;&lt;input type="number" class="size-sale-price tooltipstered" id="reg_price_4018" name="reg_price_4018" value="9.00" min="8" step="0.01" target="4018"&gt;&lt;/span&gt;&lt;/div&gt;
            &lt;div width="15%"&gt;
              &lt;span id="profit-4018" class="profit-tag"&gt;1.00&lt;/span&gt;
              &lt;input type="hidden" name="meta_target" id="meta_target-4018" value="43827"&gt;
            &lt;/div&gt;
            &lt;div width="40%"&gt;
              &lt;input type="hidden" name="meta_price_id" value="43826"&gt;
              &lt;input type="hidden" name="regular_price_id" value="43827"&gt;
              &lt;input type="hidden" name="sale_price" value="9"&gt;
              &lt;input type="hidden" name="base_price" value="8"&gt;
              &lt;input type="submit" id="meta-submit-43827" name="meta-submit-43827" value="Update"&gt;
              &lt;img src="bx_loader.gif" alt="Processing Poster Update" id="loading-4018" class="loading"&gt;
              &lt;img src="success.png" alt="Poster Update Success" id="success-4018" class="success"&gt;
              &lt;img src="error.png" alt="Poster Update Success" id="error-4018" class="error"&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/form&gt;
        &lt;form action="" id="meta-form-43832" class="poster-meta-form" novalidate="novalidate"&gt;
          &lt;div class="size-16x24 poster-tr meta-4019 meta-row-wrap"&gt;
            &lt;div width="15%"&gt;&lt;span&gt;16x24&lt;input type="hidden" name="base_amount" id="base_amount-4019" value="9"&gt;&lt;/span&gt;&lt;/div&gt;
            &lt;input type="hidden" value="43833" class="meta_price_id" id="poster_price-4019" name="poster_price-4019"&gt;
            &lt;div width="15%"&gt;&lt;span&gt;9.00&lt;input type="hidden" class="base-price" name="base_price" id="base_price-4019" value="9.00"&gt;&lt;/span&gt;&lt;/div&gt;
            &lt;div width="15%"&gt;&lt;span&gt;&lt;input type="number" class="size-sale-price tooltipstered" id="reg_price_4019" name="reg_price_4019" value="9.00" min="9" step="0.01" target="4019"&gt;&lt;/span&gt;&lt;/div&gt;
            &lt;div width="15%"&gt;
              &lt;span id="profit-4019" class="profit-tag"&gt;0.00&lt;/span&gt;
              &lt;input type="hidden" name="meta_target" id="meta_target-4019" value="43834"&gt;
            &lt;/div&gt;
            &lt;div width="40%"&gt;
              &lt;input type="hidden" name="meta_price_id" value="43833"&gt;
              &lt;input type="hidden" name="regular_price_id" value="43834"&gt;
              &lt;input type="hidden" name="sale_price" value="9"&gt;
              &lt;input type="hidden" name="base_price" value="9"&gt;
              &lt;input type="submit" id="meta-submit-43834" name="meta-submit-43834" value="Update"&gt;
              &lt;img src="bx_loader.gif" alt="Processing Poster Update" id="loading-4019" class="loading"&gt;
              &lt;img src="success.png" alt="Poster Update Success" id="success-4019" class="success"&gt;
              &lt;img src="error.png" alt="Poster Update Success" id="error-4019" class="error"&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/form&gt;
        &lt;form action="" id="meta-form-43839" class="poster-meta-form" novalidate="novalidate"&gt;
          &lt;div class="size-24x36 poster-tr meta-4020 meta-row-wrap"&gt;
            &lt;div width="15%"&gt;&lt;span&gt;24x36&lt;input type="hidden" name="base_amount" id="base_amount-4020" value="12"&gt;&lt;/span&gt;&lt;/div&gt;
            &lt;input type="hidden" value="43840" class="meta_price_id" id="poster_price-4020" name="poster_price-4020"&gt;
            &lt;div width="15%"&gt;&lt;span&gt;12.00&lt;input type="hidden" class="base-price" name="base_price" id="base_price-4020" value="12.00"&gt;&lt;/span&gt;&lt;/div&gt;
            &lt;div width="15%"&gt;&lt;span&gt;&lt;input type="number" class="size-sale-price tooltipstered" id="reg_price_4020" name="reg_price_4020" value="14.00" min="12" step="0.01" target="4020"&gt;&lt;/span&gt;&lt;/div&gt;
            &lt;div width="15%"&gt;
              &lt;span id="profit-4020" class="profit-tag"&gt;2.00&lt;/span&gt;
              &lt;input type="hidden" name="meta_target" id="meta_target-4020" value="43841"&gt;
            &lt;/div&gt;
            &lt;div width="40%"&gt;
              &lt;input type="hidden" name="meta_price_id" value="43840"&gt;
              &lt;input type="hidden" name="regular_price_id" value="43841"&gt;
              &lt;input type="hidden" name="sale_price" value="14"&gt;
              &lt;input type="hidden" name="base_price" value="12"&gt;
              &lt;input type="submit" id="meta-submit-43841" name="meta-submit-43841" value="Update"&gt;
              &lt;img src="bx_loader.gif" alt="Processing Poster Update" id="loading-4020" class="loading"&gt;
              &lt;img src="success.png" alt="Poster Update Success" id="success-4020" class="success"&gt;
              &lt;img src="error.png" alt="Poster Update Success" id="error-4020" class="error"&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/form&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JavaScripts</p>
  
  <p>jquery.validate.min.js</p>
  
  <p>additional-methods.js</p>
  
  <p>tooltipster.js</p>
  
  <pre><code>jQuery(document).ready(function () {
      //initialize tooltipster on text input elements
      jQuery('input[type="number"]').tooltipster({ //find more options on the tooltipster page
          trigger: 'custom', // default is 'hover' which is no good here
          position: 'top',
          animation: 'grow'
      });
  
      jQuery('.poster-meta-form').validate({ // initialize the plugin
          submitHandler: function (form) { 
              var sale_price_val = jQuery(this).find("input[name=sale_price]").val();
              var base_price_val = jQuery(this).find("input[name=base_price]").val();
              var meta_hidden_id = jQuery(this).find("input[name=meta_price_id]").val();
              var meta_price_id = jQuery(this).find("input[name=regular_price_id]").val();
              var parent_form = jQuery(this);
  
              jQuery.ajax({
                  type: "POST",
                  url: ajax_url,
                  data:{
                      action: 'call_back_function',
                      sale_price: sale_price_val,
                      meta: meta_hidden_id,
                      meta_price: meta_price_id
                  },
                  cache:  false,
                  beforeSend: function() {
                      parent_form.find(".loading").show();
                  },
                  success: function(data) {
                      if ( data == 0 ) {
                          parent_form.find(".loading").hide();
                          parent_form.find(".success").show();
                          setTimeout(function(){
                              parent_form.find(".success").fadeOut('slow');
                          }, 2000);
                      } else{
                          parent_form.find(".loading").hide();
                          parent_form.find(".error").show();
                          setTimeout(function(){
                              parent_form.find(".error").fadeOut('slow');
                          }, 2000);
                      };
                  }
              });
              return false;
          }
      });
      jQuery('.size-sale-price').each(function() {
              jQuery(this).rules('add', {
                  min: function(element){
                      return jQuery(element).attr('min');
                  },
                  required: true,
                  messages: {
                      number:  "Sale Price can not be less than Base Price!"
                  }
              });
          });
  
  });
  </code></pre>
  
  <p>Console Error</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'settings' of undefined
        at a.fn.init.rules (jquery.validate.min.js?ver=4.7.4:4)
        at HTMLInputElement. (social-media-sync-public.js?ver=1.0.0:534)
        at Function.each (jquery.js?ver=1.12.4:2)
        at a.fn.init.each (jquery.js?ver=1.12.4:2)
        at HTMLDocument. (social-media-sync-public.js?ver=1.0.0:532)
        at i (jquery.js?ver=1.12.4:2)
        at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
        at Function.ready (jquery.js?ver=1.12.4:2)
        at HTMLDocument.K (jquery.js?ver=1.12.4:2)</p>
  </blockquote>
  
  <p>Update</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'form' of undefined
        at a.fn.init.rules (jquery.validate.min.js?ver=4.7.4:4)
        at HTMLInputElement. (social-media-sync-public.js?ver=1.0.0:546)
        at Function.each (jquery.js?ver=1.12.4:2)
        at a.fn.init.each (jquery.js?ver=1.12.4:2)
        at HTMLDocument. (social-media-sync-public.js?ver=1.0.0:545)
        at i (jquery.js?ver=1.12.4:2)
        at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
        at Function.ready (jquery.js?ver=1.12.4:2)
        at HTMLDocument.K (jquery.js?ver=1.12.4:2)</p>
  </blockquote>