newb here, how do i best reference dynamically created form elements?
I'm new to web development, so I'm struggling to learn some basics.
I have a form. In this form is a select box. Selecting a certain option in that select box causes new form elements to appear underneath. Select any of the other options will remove them. This works fine.
My problem is, how do I best reference these new inputs once there created? So far, the only way I can reference them is by using the DOM tree, which is very code heavy (formName.childNodes...). If I try to do something like, formName.elementName, or formName.elements['elementName'], it returns a null object. There must be a better way to reference them, and I'm just too inexperienced to know what it is.
In the form, for layout I'm using a table structure, so the inputs aren't direct children of the form, making referencing them with DOM tree likely to give me carpel tunnel from all the typing I'd be doing.
Any help would be very appreciated.