title: jQuery validate and append new forms
body: <p>I have a jQuery code that handles all validations in my page and its working perfect.</p>
  <p>Today I try to dynamic create a form (jQuery append form) but its not working with the new form, which is correct because when the page is loaded the form was not there. So far so good.</p>
  <p>I'm trying to modify my code to work with this new form but I'm not sure how to do it and I need some help.</p>
  <p>Here is the code:</p>
  <pre><code>if($.isFunction($.fn.validate))
  {
      $(&quot;form.validate&quot;).each(function(i, el)
      {
          var $this = $(el),
              opts = {
                  ignore :[],
                  rules: {},
                  messages: {},
                  errorElement: 'span',
                  errorClass: 'validate-has-error',
                  highlight: function (element) {
                      $(element).closest('.form-group').addClass('validate-has-error');
                  },
                  unhighlight: function (element) {
                      $(element).closest('.form-group').removeClass('validate-has-error');
                  },
                  errorPlacement: function (error, element)
                  {
                      
                  },
                  
                  
                  submitHandler: function (form) { 
                       $(form).ajaxSubmit({
                          dataType:  'json',                              
                          error: function() {
                              
                                      
                          },
                          success: function(j) { 
  
                              if(j.success)
                              {
                                  //handle success here
                              }
                              else
                              {
                                  //handle error here     
                              }
                       
                                      
                          }
                      })
                   
                      return false;
              }
              
                  
              }
          );
          
          $this.validate(opts);
      });
  }
  </code></pre>
  <p>So for new forms I have to run the code again because I use foreach form that has class validate.</p>
  <p>I try to use the live feature of jQuery (actually is .on() now) and I have not find how to implement yet.</p>
  <p>Of course any other ideas or suggestions are welcome.</p>
  <p>Thanks.</p>