Previous version would only get the parent if it was a form element, which didn't work if the select element wasn't a direct child of the form. This now looks at all parent elements and takes the first occurence (closest parent).