I have a form with multiple text input fields and sub-forms. Is there a way to access everything based on how it appears in the DOM tree?
In other words, if I have
<div id="formContent">
<input type="text" value="some stuff" />
<ul>
<li>
<input type="text" value="some sub-stuff" />
<input type="text" value="some sub-stuff" />
<input type="text" value="some sub-stuff" />
</li>
</ul>
<input type="text" value="some stuff" />
<ul>
<li>
<input type="text" value="some sub-stuff" />
<input type="text" value="some sub-stuff" />
<input type="text" value="some sub-stuff" />
</li>
</ul>
<input type="text" value="some stuff" />
<ul>
<li>
<input type="text" value="some sub-stuff" />
<input type="text" value="some sub-stuff" />
<input type="text" value="some sub-stuff" />
</li>
</ul>
</div>
Can I access those in the order they appear and assign them values?
EDIT: The reason I ask is because I will be allowing people to add and remove the main and sub-forms, so I can't assign them id's. I also won't know how many sub-options each form will have.