code: function getClosestFormName(element) {
                      var parent = element.parent();
                      if(parent[0].tagName.toLowerCase() === 'form') {
                          return parent.attr('name') || null;
                      } else {
                          return getClosestFormName(parent);
                      }
                  }
docs: find parent form