Say I have multiple forms in my page and also multiple elements in each form. Now I need this: I know an element's id and I want to get the form's id the element is in.
Background: I need this to be able to dynamically add elements (hidden fields) to the same form that the desired element is.
Ofcourse I could loop through all document.forms, but maybe thers an easier way? Secondly I probably could loop thruogh all element's parentNodes until I find the form, but yet again maybe I'm just missing a very simple solution?
Background: I need this to be able to dynamically add elements (hidden fields) to the same form that the desired element is.
Ofcourse I could loop through all document.forms, but maybe thers an easier way? Secondly I probably could loop thruogh all element's parentNodes until I find the form, but yet again maybe I'm just missing a very simple solution?