A very general question.
I am dynamically generating a form that is split into multiple levels of tabs using HTML / JavaScript.
I want to highlight some of t
You could find out which tabbed element a field belongs to by writing an isChildOf function, like this: http://jimkeller.blogspot.com/2008/07/jquery-ischildof-is-element-child-of.html
Using the DOM to work this out will always be more "elegant" than duplicating the data in some custom format.
with the introduction of html5, you can use attributes that start with data-, and they'll still validate.
<input type="text" name="username" data-parentTab="tab1" value="non-default">
I like how John Resig did this: a script tag with arbitrary type. His example is about templating, but you could really use this for anything.
In jQuery you have the Data API for the matter. http://docs.jquery.com/Internals/jQuery.data
If you do not use jQuery, you can add your own tags and store anything in it. everybody will tell you this is not nice etc, but all the great web firms are doing so. so you will end up in a great company ;-)
The rel
attribute is often a great valid choice for storing data like this.